commit
stringlengths 40
40
| old_file
stringlengths 4
112
| new_file
stringlengths 4
112
| old_contents
stringlengths 0
2.05k
| new_contents
stringlengths 28
3.9k
| subject
stringlengths 17
736
| message
stringlengths 18
4.78k
| lang
stringclasses 1
value | license
stringclasses 13
values | repos
stringlengths 7
111k
|
---|---|---|---|---|---|---|---|---|---|
36b989cb6ffc12f7291e25bbb710e9a1d6e22203 | src/Common/Version.h | src/Common/Version.h | #define MAJOR_VERSION 3
#define MINOR_VERSION 1
#define BUILD_VERSION 0
#define BUILD_REVISION 5172
#define STRINGIFY(x) #x
#define MACRO_STRINGIFY(x) STRINGIFY(x)
#define REVISION_STRING MACRO_STRINGIFY(BUILD_REVISION)
#define VERSION_STRING MACRO_STRINGIFY(MAJOR_VERSION) "." MACRO_STRINGIFY(MINOR_VERSION) "." MACRO_STRINGIFY(BUILD_VERSION) "." MACRO_STRINGIFY(BUILD_REVISION)
| #define MAJOR_VERSION 3
#define MINOR_VERSION 2
#define BUILD_VERSION 6
#define BUILD_REVISION 45159
#define STRINGIFY(x) #x
#define MACRO_STRINGIFY(x) STRINGIFY(x)
#define REVISION_STRING MACRO_STRINGIFY(BUILD_REVISION)
#define VERSION_STRING MACRO_STRINGIFY(MAJOR_VERSION) "." MACRO_STRINGIFY(MINOR_VERSION) "." MACRO_STRINGIFY(BUILD_VERSION) "." MACRO_STRINGIFY(BUILD_REVISION)
| Update the version number of release. | Update the version number of release.
| C | apache-2.0 | google/swiftshader,google/swiftshader,google/swiftshader,bkaradzic/SwiftShader,bkaradzic/SwiftShader,bkaradzic/SwiftShader,bkaradzic/SwiftShader,bkaradzic/SwiftShader |
5b90a4de55f79f8ca1cf3ac1357fadf1451126cc | arrays/recursive-divide-and-conquer/main.c | arrays/recursive-divide-and-conquer/main.c | #include <stdio.h>
#include <stdlib.h>
#include <time.h>
#define N 100
typedef int Item;
Item max(Item *, int, int);
int main(void) {
int i;
Item m, a[N];
srand(time(NULL));
for (i = 0; i < N; ++i) {
a[i] = rand() % 1000;
}
m = max(a, 0, N-1);
printf("Max array value is: %d\n", m);
return 0;
}
Item max(Item a[], int l, int r) {
Item u, v;
int m = (l+r)/2;
if (l == r)
return a[l];
u = max(a, l, m);
v = max(a, m+1, r);
if (u > v)
return u;
else
return v;
}
| Add recursive divide and conquer algorithm for arrays | Add recursive divide and conquer algorithm for arrays
new file: arrays/recursive-divide-and-conquer/main.c
| C | mit | bartobri/data-structures-c,bartobri/data-structures-c |
|
60dcc9639dd5f36d1049f1d85bfd6bec45b2ab20 | exercises/rna-transcription/src/example.c | exercises/rna-transcription/src/example.c | #include <stdlib.h>
#include <string.h>
#include "rna_transcription.h"
char *to_rna(const char *dna) {
size_t len = strlen(dna);
char *rna = malloc(sizeof(char) * len);
for (int i = 0; i < len; i++) {
switch (dna[i]) {
case 'G':
rna[i] = 'C';
break;
case 'C':
rna[i] = 'G';
break;
case 'T':
rna[i] = 'A';
break;
case 'A':
rna[i] = 'U';
break;
default:
free(rna);
return NULL;
}
}
return rna;
}
| #include <stdlib.h>
#include <string.h>
#include "rna_transcription.h"
char *to_rna(const char *dna) {
size_t len = strlen(dna);
char *rna = malloc(sizeof(char) * len);
for (size_t i = 0; i < len; i++) {
switch (dna[i]) {
case 'G':
rna[i] = 'C';
break;
case 'C':
rna[i] = 'G';
break;
case 'T':
rna[i] = 'A';
break;
case 'A':
rna[i] = 'U';
break;
default:
free(rna);
return NULL;
}
}
return rna;
}
| Fix signed and unsigned comparison | Fix signed and unsigned comparison | C | mit | RealBarrettBrown/xc,RealBarrettBrown/xc,RealBarrettBrown/xc |
85da0a68e77dd32bd2f55d33e0d93d63b8805c8e | src/vast/concept/parseable/vast/key.h | src/vast/concept/parseable/vast/key.h | #ifndef VAST_CONCEPT_PARSEABLE_VAST_KEY_H
#define VAST_CONCEPT_PARSEABLE_VAST_KEY_H
#include "vast/key.h"
#include "vast/concept/parseable/core/choice.h"
#include "vast/concept/parseable/core/list.h"
#include "vast/concept/parseable/core/operators.h"
#include "vast/concept/parseable/core/parser.h"
#include "vast/concept/parseable/core/plus.h"
#include "vast/concept/parseable/string/char_class.h"
namespace vast {
struct key_parser : parser<key_parser> {
using attribute = key;
template <typename Iterator, typename Attribute>
bool parse(Iterator& f, Iterator const& l, Attribute& a) const {
using namespace parsers;
static auto p = +(alnum | chr{'_'} | chr{':'}) % '.';
return p.parse(f, l, a);
}
};
template <>
struct parser_registry<key> {
using type = key_parser;
};
namespace parsers {
static auto const key = make_parser<vast::key>();
} // namespace parsers
} // namespace vast
#endif
| #ifndef VAST_CONCEPT_PARSEABLE_VAST_KEY_H
#define VAST_CONCEPT_PARSEABLE_VAST_KEY_H
#include "vast/key.h"
#include "vast/concept/parseable/core/choice.h"
#include "vast/concept/parseable/core/list.h"
#include "vast/concept/parseable/core/operators.h"
#include "vast/concept/parseable/core/parser.h"
#include "vast/concept/parseable/core/plus.h"
#include "vast/concept/parseable/string/char_class.h"
namespace vast {
struct key_parser : parser<key_parser> {
using attribute = key;
template <typename Iterator, typename Attribute>
bool parse(Iterator& f, Iterator const& l, Attribute& a) const {
// FIXME: we currently cannot parse character sequences into containers,
// e.g., (alpha | '_') >> +(alnum ...). Until we have enhanced the
// framework, we'll just bail out when we find a colon at the beginning.
if (f != l && *f == ':')
return false;
using namespace parsers;
static auto p = +(alnum | chr{'_'} | chr{':'}) % '.';
return p.parse(f, l, a);
}
};
template <>
struct parser_registry<key> {
using type = key_parser;
};
namespace parsers {
static auto const key = make_parser<vast::key>();
} // namespace parsers
} // namespace vast
#endif
| Work around missing parsing functionality | Work around missing parsing functionality
| C | bsd-3-clause | mavam/vast,pmos69/vast,vast-io/vast,vast-io/vast,vast-io/vast,vast-io/vast,pmos69/vast,pmos69/vast,mavam/vast,vast-io/vast,mavam/vast,mavam/vast,pmos69/vast |
df5a968b905413ca4b89e49ba60470550a805dfb | solutions/uri/1151/1151.c | solutions/uri/1151/1151.c | #include <stdio.h>
int main() {
int n, a, b, x, i;
scanf("%d", &n);
if (n == 0) {
printf("0\n");
return 0;
}
a = 1;
b = 1;
printf("0");
for (i = 1; i < n; i++) {
printf(" %d", a);
x = a;
a = b;
b = b + x;
}
printf("\n");
return 0;
}
| Solve Easy Fibonacci in c | Solve Easy Fibonacci in c
| C | mit | deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playground |
|
6653eccd177784c911ecc39864ffe66210b41c5f | src/modules/wl_desktop_shell/e_mod_main.c | src/modules/wl_desktop_shell/e_mod_main.c | #include "e.h"
#include "e_comp_wl.h"
#include "e_mod_main.h"
#include "e_desktop_shell_protocol.h"
EAPI E_Module_Api e_modapi = { E_MODULE_API_VERSION, "Wl_Desktop_Shell" };
EAPI void *
e_modapi_init(E_Module *m)
{
E_Wayland_Desktop_Shell *shell = NULL;
/* try to allocate space for the shell structure */
if (!(shell = E_NEW(E_Wayland_Desktop_Shell, 1)))
return NULL;
/* tell the shell what compositor to use */
shell->compositor = _e_wl_comp;
/* setup compositor shell interface functions */
_e_wl_comp->shell_interface.shell = shell;
return m;
err:
/* reset compositor shell interface */
_e_wl_comp->shell_interface.shell = NULL;
/* free the allocated shell structure */
E_FREE(shell);
return NULL;
}
EAPI int
e_modapi_shutdown(E_Module *m EINA_UNUSED)
{
/* nothing to do here as shell will get the destroy callback from
* the compositor and we can cleanup there */
return 1;
}
| Add start of desktop shell code. | Add start of desktop shell code.
Signed-off-by: Chris Michael <[email protected]>
| C | bsd-2-clause | FlorentRevest/Enlightenment,tizenorg/platform.upstream.enlightenment,rvandegrift/e,tasn/enlightenment,tasn/enlightenment,FlorentRevest/Enlightenment,FlorentRevest/Enlightenment,rvandegrift/e,tizenorg/platform.upstream.enlightenment,tasn/enlightenment,tizenorg/platform.upstream.enlightenment,rvandegrift/e |
|
57c89f982987bd5dc540c3ca2407f6d735aeac6d | include/SHIZEN/zint.h | include/SHIZEN/zint.h | ////
// __| | | _ _| __ / __| \ |
// \__ \ __ | | / _| . |
// ____/ _| _| ___| ____| ___| _|\_|
//
// Copyright (c) 2017 Jacob Hauberg Hansen
//
// This library is free software; you can redistribute and modify it
// under the terms of the MIT license. See LICENSE for details.
//
#ifndef zint_h
#define zint_h
#include <stdint.h>
typedef uint8_t u8;
typedef uint16_t u16;
typedef uint32_t u32;
typedef uint64_t u64;
typedef int8_t i8;
typedef int16_t i16;
typedef int32_t i32;
typedef int64_t i64;
typedef float f32;
typedef double f64;
#endif /* zint_h */
| Add standard integer/floating point types | Add standard integer/floating point types
These help make variable intention clearer and declarations shorter.
| C | mit | jhauberg/SHIZEN |
|
8f0b7f5f5bc1eb5a1e794497d14560d032bf8dca | tests/headers/functions.h | tests/headers/functions.h | /* Header testing function definitions parsing. */
//Defining a standard function.
void f(int, int);
inline int g(char *ch, char **str);
// Defining a function pointer.
int(*fnPtr)(char, float);
// Adding dllexport and stdcall annotation to a function.
int __declspec(dllexport) __stdcall function1();
| /* Header testing function definitions parsing. */
//Defining a standard function.
void f(int, int);
// Defining a function with its implementation following
inline int g(char *ch, char **str)
{
JUNK
{ }
int localVariable = 1;
}
// Defining a function pointer.
int(*fnPtr)(char, float);
// Adding dllexport and stdcall annotation to a function.
int __declspec(dllexport) __stdcall function1();
| Add back Luke test of a function followed by its concrete implementation. | Add back Luke test of a function followed by its concrete implementation.
| C | mit | mrh1997/pyclibrary,duguxy/pyclibrary,duguxy/pyclibrary,MatthieuDartiailh/pyclibrary,mrh1997/pyclibrary,MatthieuDartiailh/pyclibrary,mrh1997/pyclibrary,duguxy/pyclibrary |
9affe3106c1a43153b26f5ef3b9f147508f07a1d | example/ex11-algo01.c | example/ex11-algo01.c | /* Based on https://en.cppreference.com/w/cpp/algorithm/for_each
Need to be built in C11 mode */
#include <stdio.h>
#include "m-array.h"
#include "m-algo.h"
/* Define a dynamic array of int */
ARRAY_DEF(vector_int, int)
#define M_OPL_vector_int_t() ARRAY_OPLIST(vector_int)
/* Define operator increment on int */
#define INC(n) (n)++
int main(void)
{
M_LET( (nums, 3, 4, 2, 8, 15, 267), vector_int_t) {
// Print the array before
printf ("before:");
ALGO_FOR_EACH(nums, vector_int_t, M_PRINT, " ");
printf ("\n");
// Increment each element of the array
ALGO_FOR_EACH(nums, vector_int_t, INC);
// Print the array after
printf ("after: ");
ALGO_FOR_EACH(nums, vector_int_t, M_PRINT, " ");
printf ("\n");
// Sum the elements of the array
int sum = 0;
ALGO_REDUCE(sum, nums, vector_int_t, add);
M_PRINT("sum = ", sum, "\n");
}
return 0;
}
| Add example of ALGO_FOR_EACH and ALGO_REDUCE | Add example of ALGO_FOR_EACH and ALGO_REDUCE
| C | bsd-2-clause | P-p-H-d/mlib,P-p-H-d/mlib |
|
bfb527e09f6fb22e4547c08c8262deb9a827e9ad | kernel/os/include/os/os_fault.h | kernel/os/include/os/os_fault.h | /*
* licensed to the apache software foundation (asf) under one
* or more contributor license agreements. see the notice file
* distributed with this work for additional information
* regarding copyright ownership. the asf licenses this file
* to you under the apache license, version 2.0 (the
* "license"); you may not use this file except in compliance
* with the license. you may obtain a copy of the license at
*
* http://www.apache.org/licenses/license-2.0
*
* unless required by applicable law or agreed to in writing,
* software distributed under the license is distributed on an
* "as is" basis, without warranties or conditions of any
* kind, either express or implied. see the license for the
* specific language governing permissions and limitations
* under the license.
*/
#ifndef _OS_FAULT_H
#define _OS_FAULT_H
#ifdef __cplusplus
extern "c" {
#endif
void __assert_func(const char *, int, const char *, const char *)
__attribute((noreturn));
#ifdef __cplusplus
}
#endif
#endif /* _OS_FAULT_H */
| /*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
#ifndef _OS_FAULT_H
#define _OS_FAULT_H
#ifdef __cplusplus
extern "c" {
#endif
void __assert_func(const char *, int, const char *, const char *)
__attribute((noreturn));
#ifdef __cplusplus
}
#endif
#endif /* _OS_FAULT_H */
| Update License to match other licenses | Update License to match other licenses
| C | apache-2.0 | andrzej-kaczmarek/incubator-mynewt-core,mlaz/mynewt-core,andrzej-kaczmarek/apache-mynewt-core,andrzej-kaczmarek/incubator-mynewt-core,mlaz/mynewt-core,IMGJulian/incubator-mynewt-core,mlaz/mynewt-core,IMGJulian/incubator-mynewt-core,wes3/incubator-mynewt-core,andrzej-kaczmarek/apache-mynewt-core,IMGJulian/incubator-mynewt-core,wes3/incubator-mynewt-core,mlaz/mynewt-core,IMGJulian/incubator-mynewt-core,mlaz/mynewt-core,andrzej-kaczmarek/incubator-mynewt-core,wes3/incubator-mynewt-core,andrzej-kaczmarek/apache-mynewt-core,andrzej-kaczmarek/incubator-mynewt-core,wes3/incubator-mynewt-core,wes3/incubator-mynewt-core,IMGJulian/incubator-mynewt-core,andrzej-kaczmarek/apache-mynewt-core,andrzej-kaczmarek/incubator-mynewt-core |
d80bdc186a97b2f1e9dee35941422cef15a49ded | fitz/stm_filter.c | fitz/stm_filter.c | #include "fitz_base.h"
#include "fitz_stream.h"
fz_error
fz_process(fz_filter *f, fz_buffer *in, fz_buffer *out)
{
fz_error reason;
unsigned char *oldrp;
unsigned char *oldwp;
assert(!out->eof);
oldrp = in->rp;
oldwp = out->wp;
if (f->done)
return fz_iodone;
reason = f->process(f, in, out);
assert(in->rp <= in->wp);
assert(out->wp <= out->ep);
f->consumed = in->rp > oldrp;
f->produced = out->wp > oldwp;
f->count += out->wp - oldwp;
/* iodone or error */
if (reason != fz_ioneedin && reason != fz_ioneedout)
{
if (reason != fz_iodone)
reason = fz_rethrow(reason, "cannot process filter");
out->eof = 1;
f->done = 1;
}
return reason;
}
fz_filter *
fz_keepfilter(fz_filter *f)
{
f->refs ++;
return f;
}
void
fz_dropfilter(fz_filter *f)
{
if (--f->refs == 0)
{
if (f->drop)
f->drop(f);
fz_free(f);
}
}
| #include "fitz_base.h"
#include "fitz_stream.h"
fz_error
fz_process(fz_filter *f, fz_buffer *in, fz_buffer *out)
{
fz_error reason;
unsigned char *oldrp;
unsigned char *oldwp;
oldrp = in->rp;
oldwp = out->wp;
if (f->done)
return fz_iodone;
assert(!out->eof);
reason = f->process(f, in, out);
assert(in->rp <= in->wp);
assert(out->wp <= out->ep);
f->consumed = in->rp > oldrp;
f->produced = out->wp > oldwp;
f->count += out->wp - oldwp;
/* iodone or error */
if (reason != fz_ioneedin && reason != fz_ioneedout)
{
if (reason != fz_iodone)
reason = fz_rethrow(reason, "cannot process filter");
out->eof = 1;
f->done = 1;
}
return reason;
}
fz_filter *
fz_keepfilter(fz_filter *f)
{
f->refs ++;
return f;
}
void
fz_dropfilter(fz_filter *f)
{
if (--f->refs == 0)
{
if (f->drop)
f->drop(f);
fz_free(f);
}
}
| Move assert test of EOF to after testing if a filter is done. | Move assert test of EOF to after testing if a filter is done.
darcs-hash:20090823143236-f546f-8a43aacda84fc3a1ab9b24c9cd54bd422912d4ec.gz
| C | agpl-3.0 | nqv/mupdf,nqv/mupdf,nqv/mupdf,nqv/mupdf,nqv/mupdf,nqv/mupdf |
eada73f748007102da090de2f6ac65691a9ea9a8 | src/canopy_os_linux.c | src/canopy_os_linux.c | // Copyright 2015 SimpleThings, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Linux implementation of OS Abstraction Layer for Canopy
#include <canopy_os.h>
#include <assert.h>
#include <stdarg.h>
#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
void canopy_os_assert(int condition) {
assert(condition);
}
void * canopy_os_alloc(size_t size) {
return malloc(size);
}
void * canopy_os_calloc(int count, size_t size) {
return calloc(count, size);
}
void canopy_os_free(void *ptr) {
free(ptr);
}
void canopy_os_log(const char *format, ...) {
va_list ap;
va_start(ap, format);
vfprintf(stderr, format, ap);
va_end(ap);
}
| // Copyright 2015 SimpleThings, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Linux implementation of OS Abstraction Layer for Canopy
#include <canopy_os.h>
#include <assert.h>
#include <stdarg.h>
#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
void * canopy_os_alloc(size_t size) {
return malloc(size);
}
void * canopy_os_calloc(int count, size_t size) {
return calloc(count, size);
}
void canopy_os_free(void *ptr) {
free(ptr);
}
void canopy_os_log(const char *format, ...) {
va_list ap;
va_start(ap, format);
vfprintf(stderr, format, ap);
va_end(ap);
}
| Remove canopy_os_assert implementation because linux implementation now just expands to assert macro in header file | Remove canopy_os_assert implementation because linux implementation now just expands to assert macro in header file
| C | apache-2.0 | canopy-project/canopy_os_linux |
0a1ed2795d54f9295335b1ab9203eb41c34f2701 | include/core/SkMilestone.h | include/core/SkMilestone.h | /*
* Copyright 2016 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#ifndef SK_MILESTONE
#define SK_MILESTONE 104
#endif
| /*
* Copyright 2016 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#ifndef SK_MILESTONE
#define SK_MILESTONE 105
#endif
| Update Skia milestone to 105 | Update Skia milestone to 105
Change-Id: I0925a52cc3a504c95ec4453e74c4580ce692275c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/548896
Reviewed-by: Eric Boren <[email protected]>
Reviewed-by: Heather Miller <[email protected]>
Auto-Submit: Heather Miller <[email protected]>
Commit-Queue: Eric Boren <[email protected]>
| C | bsd-3-clause | google/skia,google/skia,google/skia,google/skia,google/skia,google/skia,google/skia,google/skia,google/skia,google/skia |
e7b6cbacea0ca93834bb907a4d7122daed6a6a3c | backend/dummy_logic.c | backend/dummy_logic.c | #include "game_logic.h"
new_game_result bship_logic_new_game(void){
new_game_result r;
r.gid = 5;
r.pid = 7;
return r;
}
plyr_id bship_logic_join_game(game_id gid) {
if(gid != 5)
return ERR_NO_SUCH_GAME;
return 8;
}
int bship_logic_submit_grid(plyr_id pid, grid _g) {
if(pid < 7 || pid > 8)
return ERR_INVALID_PLYR_ID;
return 0;
}
int bship_logic_bomb_position(plyr_id pid, int x, int y) {
if(pid < 7 || pid > 8)
return ERR_INVALID_PLYR_ID;
if(x < 0 || y < 0)
return ERR_INVALID_BOMB_TARGET;
return 0;
}
get_game_end_result bship_logic_get_game_end(plyr_id pid) {
get_game_end_result g;
g.won = 0;
g.game_over = 0;
return g;
}
static plyr_id stored_pid = 0;
static plyr_state stored_state;
static void* stored_user;
int bship_logic_request_notify(plyr_id pid, plyr_state state, void *user) {
if(stored_pid > 0)
bship_logic_notification(stored_pid, stored_state, stored_user, 1);
stored_pid = pid;
stored_state = state;
stored_user = user;
return 0;
}
| Add dummy implementation of game_logic.h for testing | Add dummy implementation of game_logic.h for testing
| C | agpl-3.0 | wzwright/GroupDesignBattleship,GroupDesignBattleship/debian,wzwright/GroupDesignBattleship,wzwright/GroupDesignBattleship,GroupDesignBattleship/debian,wzwright/GroupDesignBattleship,GroupDesignBattleship/debian,GroupDesignBattleship/debian |
|
982dacf245ebe0aa75d19fe27c2ec74e35f180cb | bikepath/SearchItem.h | bikepath/SearchItem.h | //
// SearchItem.h
// bikepath
//
// Created by Farheen Malik on 8/15/14.
// Copyright (c) 2014 Bike Path. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <MapKit/MapKit.h>
#import <GoogleMaps/GoogleMaps.h>
@interface SearchItem : NSObject
@property NSString *searchQuery;
@property CLLocationDegrees lati;
@property CLLocationDegrees longi;
@property CLLocationCoordinate2D position;
@property (readonly) NSDate *creationDate;
@end
| //
// SearchItem.h
// bikepath
//
// Created by Farheen Malik on 8/15/14.
// Copyright (c) 2014 Bike Path. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <MapKit/MapKit.h>
#import <GoogleMaps/GoogleMaps.h>
@interface SearchItem : NSObject
@property NSString *searchQuery;
@property CLLocationDegrees lati;
@property CLLocationDegrees longi;
@property CLLocationCoordinate2D position;
@property NSString *address;
@property (readonly) NSDate *creationDate;
@end
| Add address as property of Search Item object | Add address as property of Search Item object
| C | apache-2.0 | red-spotted-newts-2014/bike-path,hushifei/bike-path,red-spotted-newts-2014/bike-path |
10e6aefe5410267b5998df8417a16a1674e2f12b | src/modtypes/socket.h | src/modtypes/socket.h | #pragma once
#include "../main.h"
class Socket {
public:
virtual ~Socket() {}
virtual unsigned int apiVersion() = 0;
virtual void connect(const std::string& server, const std::string& port, const std::string& bind = "") {}
virtual std::string receive() { return ""; }
virtual void send(const std::string& data) {}
virtual void closeConnection() {}
bool isConnected() { return connected; }
protected:
bool connected;
}; | #pragma once
#include "../main.h"
class Socket {
public:
virtual ~Socket() {}
virtual unsigned int apiVersion() = 0;
virtual void connect(const std::string& server, const std::string& port, const std::string& bindAddr = "") {}
virtual std::string receive() { return ""; }
virtual void send(const std::string& data) {}
virtual void closeConnection() {}
bool isConnected() { return connected; }
protected:
bool connected;
}; | Rename parameter to not be the same as the name of the function that does it | Rename parameter to not be the same as the name of the function that does it
| C | mit | ElementalAlchemist/RoBoBo,ElementalAlchemist/RoBoBo |
7bab840edb4a175eaa914e9fecbe8811d60e5d7e | Core/Code/Testing/mitkRenderingTestHelper.h | Core/Code/Testing/mitkRenderingTestHelper.h | /*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date: 2010-03-31 17:34:48 +0200 (Wed, 31 Mar 2010) $
Version: $Revision: 21985 $
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef mitkRenderingTestHelper_h
#define mitkRenderingTestHelper_h
#include <string>
#include <vtkSmartPointer.h>
#include <vtkRenderWindow.h>
#include <mitkRenderWindow.h>
class vtkRenderWindow;
class vtkRenderer;
namespace mitk
{
class DataStorage;
}
class MITK_CORE_EXPORT mitkRenderingTestHelper
{
public:
mitkRenderingTestHelper(int width, int height, mitk::DataStorage* ds);
~mitkRenderingTestHelper();
vtkRenderer* GetVtkRenderer();
vtkRenderWindow* GetVtkRenderWindow();
void SaveAsPNG(std::string fileName);
protected:
mitk::RenderWindow::Pointer m_RenderWindow;
};
#endif
| /*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date: 2010-03-31 17:34:48 +0200 (Wed, 31 Mar 2010) $
Version: $Revision: 21985 $
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef mitkRenderingTestHelper_h
#define mitkRenderingTestHelper_h
#include <string>
#include <vtkSmartPointer.h>
#include <vtkRenderWindow.h>
#include <mitkRenderWindow.h>
class vtkRenderWindow;
class vtkRenderer;
namespace mitk
{
class DataStorage;
}
class mitkRenderingTestHelper
{
public:
mitkRenderingTestHelper(int width, int height, mitk::DataStorage* ds);
~mitkRenderingTestHelper();
vtkRenderer* GetVtkRenderer();
vtkRenderWindow* GetVtkRenderWindow();
void SaveAsPNG(std::string fileName);
protected:
mitk::RenderWindow::Pointer m_RenderWindow;
};
#endif
| Fix linker warnings in rendering tests | Fix linker warnings in rendering tests
| C | bsd-3-clause | fmilano/mitk,NifTK/MITK,NifTK/MITK,NifTK/MITK,rfloca/MITK,danielknorr/MITK,nocnokneo/MITK,rfloca/MITK,MITK/MITK,nocnokneo/MITK,RabadanLab/MITKats,lsanzdiaz/MITK-BiiG,rfloca/MITK,danielknorr/MITK,lsanzdiaz/MITK-BiiG,fmilano/mitk,RabadanLab/MITKats,iwegner/MITK,fmilano/mitk,MITK/MITK,nocnokneo/MITK,lsanzdiaz/MITK-BiiG,rfloca/MITK,NifTK/MITK,MITK/MITK,RabadanLab/MITKats,lsanzdiaz/MITK-BiiG,iwegner/MITK,lsanzdiaz/MITK-BiiG,nocnokneo/MITK,NifTK/MITK,lsanzdiaz/MITK-BiiG,MITK/MITK,danielknorr/MITK,iwegner/MITK,MITK/MITK,RabadanLab/MITKats,fmilano/mitk,fmilano/mitk,nocnokneo/MITK,nocnokneo/MITK,danielknorr/MITK,RabadanLab/MITKats,danielknorr/MITK,lsanzdiaz/MITK-BiiG,MITK/MITK,lsanzdiaz/MITK-BiiG,iwegner/MITK,rfloca/MITK,danielknorr/MITK,iwegner/MITK,NifTK/MITK,iwegner/MITK,rfloca/MITK,rfloca/MITK,fmilano/mitk,danielknorr/MITK,fmilano/mitk,RabadanLab/MITKats,nocnokneo/MITK |
73aef2d1d8a0fe417df1ab4a35029be74891ee37 | src/gallium/winsys/sw/hgl/hgl_sw_winsys.h | src/gallium/winsys/sw/hgl/hgl_sw_winsys.h | /**************************************************************************
*
* Copyright 2009 Artur Wyszynski <[email protected]>
* Copyright 2013 Alexander von Gluck IV <[email protected]>
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sub license, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
* THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
* USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* The above copyright notice and this permission notice (including the
* next paragraph) shall be included in all copies or substantial portions
* of the Software.
*
**************************************************************************/
#ifndef _HGL_SOFTWAREWINSYS_H
#define _HGL_SOFTWAREWINSYS_H
struct sw_winsys;
struct sw_winsys* hgl_create_sw_winsys(void);
#endif
| /**************************************************************************
*
* Copyright 2009 Artur Wyszynski <[email protected]>
* Copyright 2013 Alexander von Gluck IV <[email protected]>
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sub license, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
* THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
* USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* The above copyright notice and this permission notice (including the
* next paragraph) shall be included in all copies or substantial portions
* of the Software.
*
**************************************************************************/
#ifndef _HGL_SOFTWAREWINSYS_H
#define _HGL_SOFTWAREWINSYS_H
#ifdef __cplusplus
extern "C" {
#endif
struct sw_winsys;
struct sw_winsys* hgl_create_sw_winsys(void);
#ifdef __cplusplus
}
#endif
#endif
| Add needed extern "C" to hgl winsys | winsys/hgl: Add needed extern "C" to hgl winsys
Reviewed-by: Brian Paul <[email protected]>
| C | mit | metora/MesaGLSLCompiler,metora/MesaGLSLCompiler,metora/MesaGLSLCompiler |
7f728dc9ea358c56458b5145bc8e78006fca190d | build/config/ios/WeaveProjectConfig.h | build/config/ios/WeaveProjectConfig.h | /*
*
* Copyright (c) 2016-2017 Nest Labs, Inc.
* All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* @file
* Project-specific configuration file for iOS builds.
*
*/
#ifndef WEAVEPROJECTCONFIG_H
#define WEAVEPROJECTCONFIG_H
#endif /* WEAVEPROJECTCONFIG_H */
| /*
*
* Copyright (c) 2016-2017 Nest Labs, Inc.
* All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* @file
* Project-specific configuration file for iOS builds.
*
*/
#ifndef WEAVEPROJECTCONFIG_H
#define WEAVEPROJECTCONFIG_H
#define INET_CONFIG_OVERRIDE_SYSTEM_TCP_USER_TIMEOUT 0
#endif /* WEAVEPROJECTCONFIG_H */
| Disable unsupported Inet configuration breaking iOS integration. | Disable unsupported Inet configuration breaking iOS integration.
For a yet-unknown reason, trying to read the TCP Tx buffer with ioctl on iOS fails with ENXIO. Since this code was written primarily for embedded Linux platforms, and is not needed for mobile clients, this CL turns off that bit of code for iOS builds. | C | apache-2.0 | openweave/openweave-core,openweave/openweave-core,openweave/openweave-core,openweave/openweave-core,openweave/openweave-core,openweave/openweave-core |
f7ec6e5c53d147637fafde9d908b9f24814ecce5 | Settings/Updater/UpdaterWindow.h | Settings/Updater/UpdaterWindow.h | #pragma once
#include "../3RVX/Window.h"
class NotifyIcon;
class Settings;
class UpdaterWindow : public Window {
public:
UpdaterWindow();
~UpdaterWindow();
void DoModal();
private:
HICON _smallIcon;
HICON _largeIcon;
NotifyIcon *_notifyIcon;
HMENU _menu;
UINT _menuFlags;
Settings *_settings;
std::pair<int, int> _version;
std::wstring _versionString;
void InstallUpdate();
virtual LRESULT WndProc(HWND hWnd, UINT message,
WPARAM wParam, LPARAM lParam);
public:
static const int MENU_INSTALL = 0;
static const int MENU_IGNORE = 1;
static const int MENU_REMIND = 2;
}; | #pragma once
#include "../../3RVX/Window.h"
#include "Version.h"
class NotifyIcon;
class Settings;
class UpdaterWindow : public Window {
public:
UpdaterWindow();
~UpdaterWindow();
void DoModal();
private:
HICON _smallIcon;
HICON _largeIcon;
NotifyIcon *_notifyIcon;
HMENU _menu;
UINT _menuFlags;
Settings *_settings;
Version _version;
void InstallUpdate();
virtual LRESULT WndProc(HWND hWnd, UINT message,
WPARAM wParam, LPARAM lParam);
public:
static const int MENU_INSTALL = 0;
static const int MENU_IGNORE = 1;
static const int MENU_REMIND = 2;
}; | Clean up instance variables and imports | Clean up instance variables and imports
| C | bsd-2-clause | malensek/3RVX,malensek/3RVX,malensek/3RVX |
a77e006fa0a5c215e4b48a21e70dd323d165a5b4 | test/CodeGen/2004-06-17-UnorderedCompares.c | test/CodeGen/2004-06-17-UnorderedCompares.c | // RUN: %clang_cc1 -std=c99 %s -emit-llvm -o - | grep -v llvm.isunordered | not grep call
_Bool A, B, C, D, E, F;
void TestF(float X, float Y) {
A = __builtin_isgreater(X, Y);
B = __builtin_isgreaterequal(X, Y);
C = __builtin_isless(X, Y);
D = __builtin_islessequal(X, Y);
E = __builtin_islessgreater(X, Y);
F = __builtin_isunordered(X, Y);
}
void TestD(double X, double Y) {
A = __builtin_isgreater(X, Y);
B = __builtin_isgreaterequal(X, Y);
C = __builtin_isless(X, Y);
D = __builtin_islessequal(X, Y);
E = __builtin_islessgreater(X, Y);
F = __builtin_isunordered(X, Y);
}
| // RUN: %clang_cc1 -std=c99 %s -emit-llvm -o - | FileCheck %s
// CHECK: @Test
// CHECK-NOT: call
_Bool A, B, C, D, E, F;
void TestF(float X, float Y) {
A = __builtin_isgreater(X, Y);
B = __builtin_isgreaterequal(X, Y);
C = __builtin_isless(X, Y);
D = __builtin_islessequal(X, Y);
E = __builtin_islessgreater(X, Y);
F = __builtin_isunordered(X, Y);
}
void TestD(double X, double Y) {
A = __builtin_isgreater(X, Y);
B = __builtin_isgreaterequal(X, Y);
C = __builtin_isless(X, Y);
D = __builtin_islessequal(X, Y);
E = __builtin_islessgreater(X, Y);
F = __builtin_isunordered(X, Y);
}
| Remove pathname dependence. Also rewrite test to use FileCheck at the same time. | Remove pathname dependence. Also rewrite test to use FileCheck
at the same time.
Patch by David Callahan.
git-svn-id: ffe668792ed300d6c2daa1f6eba2e0aa28d7ec6c@226331 91177308-0d34-0410-b5e6-96231b3b80d8
| C | apache-2.0 | llvm-mirror/clang,apple/swift-clang,apple/swift-clang,llvm-mirror/clang,llvm-mirror/clang,apple/swift-clang,apple/swift-clang,apple/swift-clang,llvm-mirror/clang,apple/swift-clang,apple/swift-clang,llvm-mirror/clang,apple/swift-clang,llvm-mirror/clang,llvm-mirror/clang,llvm-mirror/clang,apple/swift-clang,llvm-mirror/clang,llvm-mirror/clang,apple/swift-clang |
ce9a5f7402d60ca92a2585f077d4668694fcb83d | include/VolViz/src/GeometryDescriptor.h | include/VolViz/src/GeometryDescriptor.h | #ifndef VolViz_Geometry_h
#define VolViz_Geometry_h
#include "Types.h"
namespace VolViz {
struct GeometryDescriptor {
bool movable{true};
Color color{Colors::White()};
};
struct AxisAlignedPlaneDescriptor : public GeometryDescriptor {
Length intercept{0 * meter};
Axis axis{Axis::X};
};
} // namespace VolViz
#endif // VolViz_Geometry_h
| Add descriptors for various geometries | Add descriptors for various geometries
| C | mit | ithron/VolViz,ithron/VolViz,ithron/VolViz |
|
3eec82ff013efb8ecd9a40fd58173e28331fe3d9 | test2/code_gen/deref_reg.c | test2/code_gen/deref_reg.c | // RUN: %ucc -DFIRST -S -o- %s | grep -F 'movl (%%rax), %%eax'
// RUN: %ucc -DSECOND -S -o- %s | grep -F 'movl 4(%%rbx), %%ebx'
#ifdef FIRST
f(int *p)
{
return *p;
// should see that p isn't used after/.retains==1 and not create a new reg,
// but re-use the current
}
#elif defined(SECOND)
struct A
{
int i, j;
};
g(struct A *p)
{
return p->i + p->j;
}
#else
# error neither
#endif
| // RUN: %ucc -DFIRST -S -o- %s | grep -F 'movl (%%rax), %%eax'
// RUN: %ucc -DSECOND -S -o- %s | grep -F 'movl 4(%%rcx), %%ecx'
#ifdef FIRST
f(int *p)
{
return *p;
// should see that p isn't used after/.retains==1 and not create a new reg,
// but re-use the current
}
#elif defined(SECOND)
struct A
{
int i, j;
};
g(struct A *p)
{
return p->i + p->j;
}
#else
# error neither
#endif
| Change test now %ebx is callee-save | Change test now %ebx is callee-save
| C | mit | bobrippling/ucc-c-compiler,bobrippling/ucc-c-compiler,bobrippling/ucc-c-compiler |
4a4095c360fc29f766e8baba3529a78b6d736b19 | json-glib/json-glib.h | json-glib/json-glib.h | #ifndef __JSON_GLIB_H__
#define __JSON_GLIB_H__
#include <json-glib/json-types.h>
#include <json-glib/json-generator.h>
#include <json-glib/json-parser.h>
#include <json-glib/json-version.h>
#endif /* __JSON_GLIB_H__ */
| #ifndef __JSON_GLIB_H__
#define __JSON_GLIB_H__
#include <json-glib/json-types.h>
#include <json-glib/json-scanner.h>
#include <json-glib/json-generator.h>
#include <json-glib/json-parser.h>
#include <json-glib/json-version.h>
#endif /* __JSON_GLIB_H__ */
| Add json-scanner.h to the exported headers | Add json-scanner.h to the exported headers
| C | lgpl-2.1 | robtaylor/json-glib-gvariant,GNOME/json-glib,frida/json-glib,ebassi/json-glib,oerdnj/json-glib,oerdnj/json-glib,Distrotech/json-glib,ebassi/json-glib,robtaylor/json-glib-gvariant,ebassi/json-glib,oerdnj/json-glib,Distrotech/json-glib,GNOME/json-glib,brauliobo/json-glib,oerdnj/json-glib,frida/json-glib,brauliobo/json-glib,brauliobo/json-glib,Distrotech/json-glib |
81c02ef3db6901655f8a7117e5e2675d37096daf | json-glib/json-glib.h | json-glib/json-glib.h | #ifndef __JSON_GLIB_H__
#define __JSON_GLIB_H__
#include <json-glib/json-types.h>
#include <json-glib/json-scanner.h>
#include <json-glib/json-generator.h>
#include <json-glib/json-parser.h>
#include <json-glib/json-version.h>
#include <json-glib/json-enum-types.h>
#endif /* __JSON_GLIB_H__ */
| #ifndef __JSON_GLIB_H__
#define __JSON_GLIB_H__
#include <json-glib/json-types.h>
#include <json-glib/json-generator.h>
#include <json-glib/json-parser.h>
#include <json-glib/json-version.h>
#include <json-glib/json-enum-types.h>
#endif /* __JSON_GLIB_H__ */
| Remove the include for json-scanner.h | Remove the include for json-scanner.h
The json-scanner.h header file is not shipped with JSON-GLib anymore.
| C | lgpl-2.1 | Distrotech/json-glib,GNOME/json-glib,brauliobo/json-glib,ebassi/json-glib,oerdnj/json-glib,Distrotech/json-glib,frida/json-glib,GNOME/json-glib,robtaylor/json-glib-gvariant,oerdnj/json-glib,robtaylor/json-glib-gvariant,brauliobo/json-glib,ebassi/json-glib,oerdnj/json-glib,oerdnj/json-glib,frida/json-glib,brauliobo/json-glib,ebassi/json-glib,Distrotech/json-glib |
42745caac82bac289f9f5d5476c4f1e9bb29624b | Extends/NSTLocalFileError.h | Extends/NSTLocalFileError.h | //
// NSTLocalFileError.h
// Pods
//
// Created by Anatoly Shcherbinin on 5.04.22.
//
#ifndef NSTLocalFileError_h
#define NSTLocalFileError_h
///Quick error domain for errors that should be generated and handled localy in one source file
#define NSTLocalFileErrorDomain (@__FILE_NAME__)
///Convenience method for generation errors with localized description
///Generated error will have file name where occured as domain and code as line
#define NSTLocalFileErrorWithMessage(message) _localFileErrorWithMessage(NSTLocalFileErrorDomain, __LINE__, (message))
///Convenience method for generation errors with cpecefied code
///Can be used if error handled in the same file and error handling if depends on code
#define NSTLocalFileErrorWithCode(code) _localFileErrorWithMessage(NSTLocalFileErrorDomain, (code), nil)
CF_INLINE NSError *_localFileErrorWithMessage(NSErrorDomain domain, NSInteger code, NSString *message) {
return [NSError errorWithDomain:domain
code:code
userInfo:( nil == message
? nil
: @ { NSLocalizedDescriptionKey: message }
)];
}
#endif /* NSTLocalFileError_h */
| Add convenience macros for generation locally handled errors | Add convenience macros for generation locally handled errors
| C | mit | netcosports/NS-Categories,netcosports/NS-Categories,netcosports/NS-Categories,netcosports/NS-Categories |
|
4024adee156f12bbeb884c5a2c5ea1af1c108b5a | test/test_chip8.c | test/test_chip8.c | #include <assert.h>
#include "../src/chip8.c"
void test_clear_screen(void) {
int i;
chip8_t * chip8 = chip8_new();
chip8->memory[0x200] = 0x00;
chip8->memory[0x201] = 0xE0;
chip8_fetch_current_opcode(chip8);
chip8_decode_current_opcode(chip8);
i = 0;
while (i < 64 * 32) {
assert(chip8->memory[i++] == 0);
}
}
void test_instruction_jump(void) {
chip8_t * chip8 = chip8_new();
chip8->memory[0x200] = 0x11;
chip8->memory[0x201] = 0x23;
chip8_fetch_current_opcode(chip8);
chip8_decode_current_opcode(chip8);
assert(chip8->program_counter == 0x123);
}
int main(int argc, char ** argv) {
test_clear_screen();
test_instruction_jump();
}
| #include <assert.h>
#include "../src/chip8.c"
void test_clear_screen(void) {
int i;
chip8_t * chip8 = chip8_new();
chip8->memory[0x200] = 0x00;
chip8->memory[0x201] = 0xE0;
chip8_fetch_current_opcode(chip8);
chip8_decode_current_opcode(chip8);
i = 0;
while (i < 64 * 32) {
assert(chip8->memory[i++] == 0);
}
}
void test_instruction_jump(void) {
chip8_t * chip8 = chip8_new();
chip8->memory[0x200] = 0x11;
chip8->memory[0x201] = 0x23;
chip8_fetch_current_opcode(chip8);
chip8_decode_current_opcode(chip8);
assert(chip8->program_counter == 0x123);
}
int main(int argc, char ** argv) {
test_clear_screen();
test_instruction_jump();
return 0;
}
| Exit the tests with success if they aren't failing | Exit the tests with success if they aren't failing
| C | mit | gsamokovarov/chip8.c,gsamokovarov/chip8.c |
b09bd3d3896c448f8817ee7515e3af0314605ab1 | plrCommon/plrCompare.c | plrCommon/plrCompare.c | #include "plrCompare.h"
int plrC_compareArgs(const syscallArgs_t *args1, const syscallArgs_t *args2) {
int foundDiff = 0;
if (args1->addr != args2->addr) { foundDiff = 1; }
else if (args1->arg[0] != args2->arg[0]) { foundDiff = 2; }
else if (args1->arg[1] != args2->arg[1]) { foundDiff = 3; }
else if (args1->arg[2] != args2->arg[2]) { foundDiff = 4; }
else if (args1->arg[3] != args2->arg[3]) { foundDiff = 5; }
else if (args1->arg[4] != args2->arg[4]) { foundDiff = 6; }
else if (args1->arg[5] != args2->arg[5]) { foundDiff = 7; }
return foundDiff;
}
| #include "plrCompare.h"
#include <stdio.h>
int plrC_compareArgs(const syscallArgs_t *args1, const syscallArgs_t *args2) {
int faultVal = 0;
#define CompareElement(elem, faultBit) \
if (args1->elem != args2->elem) { \
faultVal |= 1 << faultBit; \
printf("Argument miscompare in " #elem ", 0x%lX != 0x%lX\n", \
(unsigned long)args1->elem, (unsigned long)args2->elem); \
}
CompareElement(addr, 0);
CompareElement(arg[0], 1);
CompareElement(arg[1], 2);
CompareElement(arg[2], 3);
CompareElement(arg[3], 4);
CompareElement(arg[4], 5);
CompareElement(arg[5], 6);
return faultVal;
}
| Add logging to syscall arg compare for debugging purposes | Add logging to syscall arg compare for debugging purposes
| C | mit | apogeedev/plr,apogeedev/plr |
e1e5b704393cc348af07e62e1ec69521f9a6ab9e | src/simply/simply_window_stack.h | src/simply/simply_window_stack.h | #pragma once
#include "simply_window.h"
#include "simply_msg.h"
#include "simply.h"
#include "util/sdk.h"
#include <pebble.h>
typedef struct SimplyWindowStack SimplyWindowStack;
struct SimplyWindowStack {
Simply *simply;
#ifdef PBL_SDK_2
Window *pusher;
#endif
bool is_showing:1;
bool is_hiding:1;
};
SimplyWindowStack *simply_window_stack_create(Simply *simply);
void simply_window_stack_destroy(SimplyWindowStack *self);
bool simply_window_stack_set_broadcast(bool broadcast);
SimplyWindow *simply_window_stack_get_top_window(Simply *simply);
void simply_window_stack_show(SimplyWindowStack *self, SimplyWindow *window, bool is_push);
void simply_window_stack_pop(SimplyWindowStack *self, SimplyWindow *window);
void simply_window_stack_back(SimplyWindowStack *self, SimplyWindow *window);
void simply_window_stack_send_show(SimplyWindowStack *self, SimplyWindow *window);
void simply_window_stack_send_hide(SimplyWindowStack *self, SimplyWindow *window);
bool simply_window_stack_handle_packet(Simply *simply, Packet *packet);
| #pragma once
#include "simply_window.h"
#include "simply_msg.h"
#include "simply.h"
#include "util/sdk.h"
#include <pebble.h>
typedef struct SimplyWindowStack SimplyWindowStack;
struct SimplyWindowStack {
Simply *simply;
SDK_SELECT(NONE, Window *pusher);
bool is_showing:1;
bool is_hiding:1;
};
SimplyWindowStack *simply_window_stack_create(Simply *simply);
void simply_window_stack_destroy(SimplyWindowStack *self);
bool simply_window_stack_set_broadcast(bool broadcast);
SimplyWindow *simply_window_stack_get_top_window(Simply *simply);
void simply_window_stack_show(SimplyWindowStack *self, SimplyWindow *window, bool is_push);
void simply_window_stack_pop(SimplyWindowStack *self, SimplyWindow *window);
void simply_window_stack_back(SimplyWindowStack *self, SimplyWindow *window);
void simply_window_stack_send_show(SimplyWindowStack *self, SimplyWindow *window);
void simply_window_stack_send_hide(SimplyWindowStack *self, SimplyWindow *window);
bool simply_window_stack_handle_packet(Simply *simply, Packet *packet);
| Use SDK_SELECT for the window stack pusher member field | Use SDK_SELECT for the window stack pusher member field
| C | mit | frizzr/CatchOneBus,youtux/PebbleShows,fletchto99/pebblejs,carlo-colombo/dublin-bus-pebble,ishepard/TransmissionTorrent,ishepard/TransmissionTorrent,frizzr/CatchOneBus,carlo-colombo/dublin-bus-pebble,pebble/pebblejs,ento/pebblejs,demophoon/Trimet-Tracker,carlo-colombo/dublin-bus-pebble,gwijsman/OpenRemotePebble,youtux/PebbleShows,jsfi/pebblejs,youtux/pebblejs,youtux/pebblejs,pebble/pebblejs,sunshineyyy/CatchOneBus,sunshineyyy/CatchOneBus,gwijsman/OpenRemotePebble,demophoon/Trimet-Tracker,effata/pebblejs,youtux/pebblejs,daduke/LMSController,bkbilly/Tvheadend-EPG,demophoon/Trimet-Tracker,frizzr/CatchOneBus,pebble/pebblejs,fletchto99/pebblejs,daduke/LMSController,bkbilly/Tvheadend-EPG,jiangege/pebblejs-project,youtux/PebbleShows,youtux/PebbleShows,fletchto99/pebblejs,jsfi/pebblejs,daduke/LMSController,jiangege/pebblejs-project,gwijsman/OpenRemotePebble,bkbilly/Tvheadend-EPG,pebble/pebblejs,sunshineyyy/CatchOneBus,effata/pebblejs,bkbilly/Tvheadend-EPG,daduke/LMSController,gwijsman/OpenRemotePebble,fletchto99/pebblejs,sunshineyyy/CatchOneBus,bkbilly/Tvheadend-EPG,daduke/LMSController,jiangege/pebblejs-project,gwijsman/OpenRemotePebble,carlo-colombo/dublin-bus-pebble,ento/pebblejs,ishepard/TransmissionTorrent,jsfi/pebblejs,effata/pebblejs,carlo-colombo/dublin-bus-pebble,fletchto99/pebblejs,pebble/pebblejs,ishepard/TransmissionTorrent,jiangege/pebblejs-project,sunshineyyy/CatchOneBus,youtux/pebblejs,effata/pebblejs,demophoon/Trimet-Tracker,ento/pebblejs,effata/pebblejs,jsfi/pebblejs,jiangege/pebblejs-project,ento/pebblejs,youtux/pebblejs,frizzr/CatchOneBus,demophoon/Trimet-Tracker,jsfi/pebblejs,ishepard/TransmissionTorrent,ento/pebblejs |
b8aff13260f0ed1de59387e899cb65b75a10c3c9 | src/compat/libc/string/inhibit_libcall.h | src/compat/libc/string/inhibit_libcall.h | /**
* @file
* @brief
*
* @author Anton Kozlov
* @date 21.07.2015
*/
#ifndef STR_INHIBIT_LIBCALL_H_
#define STR_INHIBIT_LIBCALL_H_
/* FIXME __attribute__ ((__optimize__ ("-fno-tree-loop-distribute-patterns")))
* can be not supported in cross-compiler
*/
#define HAVE_CC_INHIBIT_LOOP_TO_LIBCALL 1
#ifdef HAVE_CC_INHIBIT_LOOP_TO_LIBCALL
# define inhibit_loop_to_libcall \
__attribute__ ((__optimize__ ("-fno-tree-loop-distribute-patterns")))
#else
# define inhibit_loop_to_libcall
#endif
#endif /* STR_INHIBIT_LIBCALL_H_ */
| /**
* @file
* @brief
*
* @author Anton Kozlov
* @date 21.07.2015
*/
#ifndef STR_INHIBIT_LIBCALL_H_
#define STR_INHIBIT_LIBCALL_H_
/* FIXME __attribute__ ((__optimize__ ("-fno-tree-loop-distribute-patterns")))
* can be not supported in cross-compiler
*/
#ifndef __e2k__
#define HAVE_CC_INHIBIT_LOOP_TO_LIBCALL 1
#endif /* __e2k__ */
#ifdef HAVE_CC_INHIBIT_LOOP_TO_LIBCALL
# define inhibit_loop_to_libcall \
__attribute__ ((__optimize__ ("-fno-tree-loop-distribute-patterns")))
#else
# define inhibit_loop_to_libcall
#endif
#endif /* STR_INHIBIT_LIBCALL_H_ */
| Fix inhibit_loop_to_libcall compilation on e2k | compat: Fix inhibit_loop_to_libcall compilation on e2k
| C | bsd-2-clause | embox/embox,embox/embox,embox/embox,embox/embox,embox/embox,embox/embox |
259598230240544af945254ed834a32eebec2608 | Pod/Classes/Utils/UIColor+HKHex.h | Pod/Classes/Utils/UIColor+HKHex.h | //
// UIColor+HKHex.h
// HKProjectBase-Sample
//
// Created by Harley.xk on 15/8/26.
// Copyright (c) 2015年 Harley.xk. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface UIColor (HKHex)
+ (UIColor *)colorWithHexString:(NSString *)hexString;
+ (UIColor *)colorWithHexString:(NSString *)hexString alpha:(CGFloat)alpha;
@end
| //
// UIColor+HKHex.h
// HKProjectBase-Sample
//
// Created by Harley.xk on 15/8/26.
// Copyright (c) 2015年 Harley.xk. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface UIColor (HKHex)
/**
* 使用16进制字符串创建颜色
*
* @param hexString 16进制字符串,可以是 0XFFFFFF/#FFFFFF/FFFFFF 三种格式之一
*
* @return 返回创建的UIColor对象
*/
+ (UIColor *)colorWithHexString:(NSString *)hexString;
+ (UIColor *)colorWithHexString:(NSString *)hexString alpha:(CGFloat)alpha;
@end
| Add comment to Hex color category | Add comment to Hex color category
| C | mit | Harley-xk/HKProjectBase,Harley-xk/HKProjectBase,Harley-xk/HKProjectBase |
21b2d73ef61e40b611792ce772a774438b2f459d | src/ConfigFileReader.h | src/ConfigFileReader.h | #pragma once
#include <iostream>
#include <fstream>
#include <string>
#include <unordered_map>
#include <algorithm>
//#include <locale>
class ConfigFileReader
{
public:
ConfigFileReader(const char* file_name);
std::string find(std::string key);
private:
std::ifstream iniFile;
std::unordered_map<std::string, std::string> hashmap;
};
| #pragma once
#include <iostream>
#include <fstream>
#include <string>
#include <unordered_map>
#include <algorithm>
class ConfigFileReader
{
public:
ConfigFileReader(const char* file_name);
std::string find(std::string key);
private:
std::ifstream iniFile;
std::unordered_map<std::string, std::string> hashmap;
}; | Remove unnecessary includes and newlines | Remove unnecessary includes and newlines
| C | agpl-3.0 | UCSolarCarTeam/Schulich-Delta-OnBoard-Media-Control,UCSolarCarTeam/Schulich-Delta-OnBoard-Media-Control |
412799711a2b6ae29c865159df88e0bbe19fd2df | src/lib/str-sanitize.c | src/lib/str-sanitize.c | /* Copyright (c) 2004 Timo Sirainen */
#include "lib.h"
#include "str.h"
#include "str-sanitize.h"
void str_sanitize_append(string_t *dest, const char *src, size_t max_len)
{
const char *p;
for (p = src; *p != '\0'; p++) {
if ((unsigned char)*p < 32)
break;
}
str_append_n(dest, src, (size_t)(p - src));
for (; *p != '\0' && max_len > 0; p++, max_len--) {
if ((unsigned char)*p < 32)
str_append_c(dest, '?');
else
str_append_c(dest, *p);
}
if (*p != '\0') {
str_truncate(dest, str_len(dest)-3);
str_append(dest, "...");
}
}
const char *str_sanitize(const char *src, size_t max_len)
{
string_t *str;
str = t_str_new(I_MIN(max_len, 256));
str_sanitize_append(str, src, max_len);
return str_c(str);
}
| /* Copyright (c) 2004 Timo Sirainen */
#include "lib.h"
#include "str.h"
#include "str-sanitize.h"
void str_sanitize_append(string_t *dest, const char *src, size_t max_len)
{
const char *p;
for (p = src; *p != '\0'; p++) {
if (((unsigned char)*p & 0x7f) < 32)
break;
}
str_append_n(dest, src, (size_t)(p - src));
for (; *p != '\0' && max_len > 0; p++, max_len--) {
if (((unsigned char)*p & 0x7f) < 32)
str_append_c(dest, '?');
else
str_append_c(dest, *p);
}
if (*p != '\0') {
str_truncate(dest, str_len(dest)-3);
str_append(dest, "...");
}
}
const char *str_sanitize(const char *src, size_t max_len)
{
string_t *str;
str = t_str_new(I_MIN(max_len, 256));
str_sanitize_append(str, src, max_len);
return str_c(str);
}
| Convert also 0x80..0x9f characters to '?' | Convert also 0x80..0x9f characters to '?'
| C | mit | damoxc/dovecot,damoxc/dovecot,damoxc/dovecot,damoxc/dovecot,damoxc/dovecot |
a42c50b4ccc19c05ccf6dd1fa066677eea12ee6a | src/host/os_copyfile.c | src/host/os_copyfile.c | /**
* \file os_copyfile.c
* \brief Copy a file from one location to another.
* \author Copyright (c) 2002-2008 Jason Perkins and the Premake project
*/
#include <stdlib.h>
#include "premake.h"
int os_copyfile(lua_State* L)
{
int z;
const char* src = luaL_checkstring(L, 1);
const char* dst = luaL_checkstring(L, 2);
#if PLATFORM_WINDOWS
z = CopyFileA(src, dst, FALSE);
#else
lua_pushfstring(L, "cp %s %s", src, dst);
z = (system(lua_tostring(L, -1)) == 0);
#endif
if (!z)
{
lua_pushnil(L);
lua_pushfstring(L, "unable to copy file to '%s'", dst);
return 2;
}
else
{
lua_pushboolean(L, 1);
return 1;
}
}
| /**
* \file os_copyfile.c
* \brief Copy a file from one location to another.
* \author Copyright (c) 2002-2008 Jason Perkins and the Premake project
*/
#include <stdlib.h>
#include "premake.h"
int os_copyfile(lua_State* L)
{
int z;
const char* src = luaL_checkstring(L, 1);
const char* dst = luaL_checkstring(L, 2);
#if PLATFORM_WINDOWS
z = CopyFileA(src, dst, FALSE);
#else
lua_pushfstring(L, "cp \"%s\" \"%s\"", src, dst);
z = (system(lua_tostring(L, -1)) == 0);
#endif
if (!z)
{
lua_pushnil(L);
lua_pushfstring(L, "unable to copy file to '%s'", dst);
return 2;
}
else
{
lua_pushboolean(L, 1);
return 1;
}
}
| Fix os.copyfile with spaces in argument paths. | Host/Posix: Fix os.copyfile with spaces in argument paths. | C | bsd-3-clause | tvandijck/premake-core,Zefiros-Software/premake-core,noresources/premake-core,sleepingwit/premake-core,xriss/premake-core,LORgames/premake-core,mendsley/premake-core,bravnsgaard/premake-core,LORgames/premake-core,noresources/premake-core,jstewart-amd/premake-core,LORgames/premake-core,dcourtois/premake-core,tvandijck/premake-core,premake/premake-core,TurkeyMan/premake-core,resetnow/premake-core,Blizzard/premake-core,aleksijuvani/premake-core,xriss/premake-core,TurkeyMan/premake-core,Blizzard/premake-core,tvandijck/premake-core,sleepingwit/premake-core,bravnsgaard/premake-core,mandersan/premake-core,CodeAnxiety/premake-core,starkos/premake-core,LORgames/premake-core,CodeAnxiety/premake-core,dcourtois/premake-core,resetnow/premake-core,starkos/premake-core,noresources/premake-core,mandersan/premake-core,starkos/premake-core,Zefiros-Software/premake-core,jstewart-amd/premake-core,TurkeyMan/premake-core,xriss/premake-core,mendsley/premake-core,mendsley/premake-core,CodeAnxiety/premake-core,premake/premake-core,aleksijuvani/premake-core,premake/premake-core,tvandijck/premake-core,aleksijuvani/premake-core,dcourtois/premake-core,dcourtois/premake-core,Zefiros-Software/premake-core,Blizzard/premake-core,noresources/premake-core,CodeAnxiety/premake-core,aleksijuvani/premake-core,dcourtois/premake-core,resetnow/premake-core,Blizzard/premake-core,jstewart-amd/premake-core,CodeAnxiety/premake-core,jstewart-amd/premake-core,premake/premake-core,sleepingwit/premake-core,Zefiros-Software/premake-core,soundsrc/premake-core,sleepingwit/premake-core,noresources/premake-core,mendsley/premake-core,resetnow/premake-core,xriss/premake-core,soundsrc/premake-core,premake/premake-core,starkos/premake-core,resetnow/premake-core,premake/premake-core,starkos/premake-core,soundsrc/premake-core,lizh06/premake-core,mandersan/premake-core,lizh06/premake-core,bravnsgaard/premake-core,premake/premake-core,lizh06/premake-core,lizh06/premake-core,Blizzard/premake-core,soundsrc/premake-core,soundsrc/premake-core,bravnsgaard/premake-core,aleksijuvani/premake-core,TurkeyMan/premake-core,xriss/premake-core,noresources/premake-core,jstewart-amd/premake-core,starkos/premake-core,bravnsgaard/premake-core,Zefiros-Software/premake-core,LORgames/premake-core,dcourtois/premake-core,mandersan/premake-core,dcourtois/premake-core,Blizzard/premake-core,mandersan/premake-core,TurkeyMan/premake-core,sleepingwit/premake-core,tvandijck/premake-core,noresources/premake-core,mendsley/premake-core,starkos/premake-core |
58d8ac057e53be1a71a519fe4db7d83e7cf8056a | submission_test/Role.h | submission_test/Role.h | #ifndef ROLE_H_
#define ROLE_H_
#include "State.h"
class Role{
public:
State& state;
int x,y;
Role(State _state, int _id = 0, int _x = 0, int _y = 0) : state(_state), id(_id), x(_x), y(_y) {}
int getID(){
return id;
}
virtual void move() = 0;
private:
//changing id is impossible
int id;
};
#endif
|
#ifndef ROLE_H_
#define ROLE_H_
#include "State.h"
#include "Location.h"
#include <vector>
// this class is partial abstract
class Role {
public:
// reference to the main state
State& state;
// neighbors
std::vector<int> neighbors;
private:
// position of the ant
int x, y;
// ant's id
int id;
public:
// -- virtual functions that will be implemented separately
// communicate
virtual void receive ( int msg ) {
// do nothing
}
// action move
virtual int move() = 0;
void run(void) const {
int result = move();
if ( 0 < result and result < TDIRECTION ) {
state.makeMove( getLocation(), result );
}
}
// helper functions
// return location of the ant
Location getLocation(void) const {
return Location( x, y );
}
// return the id of the ant
int getID() const {
return id;
}
// constructor
Role(State _state, int _id = 0, int _x = 0, int _y = 0) : state(_state), id(_id), x(_x), y(_y) {}
};
#endif
| Add more features ( made it more functional ) | Add more features ( made it more functional )
| C | mit | KorlaMarch/Ant-bot,KorlaMarch/Ant-bot,KorlaMarch/Ant-bot,KorlaMarch/Ant-bot,KorlaMarch/Ant-bot,KorlaMarch/Ant-bot,KorlaMarch/Ant-bot |
d569c69ea1a361ada0e09f2c58bd611b686d82e9 | modules/dcc_chat.h | modules/dcc_chat.h | class dccChat : public Module {
public:
void onDCCReceive(std::string dccid, std::string message);
};
class dccSender : public Module {
public:
void dccSend(std::string dccid, std::string message);
}; | class dccChat : public Module {
public:
virtual void onDCCReceive(std::string dccid, std::string message);
};
class dccSender : public Module {
public:
virtual void dccSend(std::string dccid, std::string message);
virtual bool hookDCCMessage(std::string modName, std::string hookMsg);
}; | Fix those functions not being virtual. | Fix those functions not being virtual.
| C | mit | ElementalAlchemist/RoBoBo,ElementalAlchemist/RoBoBo |
dadb6d44743b45f60dc95d833b22f3de1e6dbd7d | qtcreator/cutelyst/classes/controller.h | qtcreator/cutelyst/classes/controller.h | %{Cpp:LicenseTemplate}\
#ifndef %{GUARD}
#define %{GUARD}
#include <Cutelyst/Controller>
%{JS: Cpp.openNamespaces('%{Class}')}\
using namespace Cutelyst;
class %{CN} : public Controller
{
Q_OBJECT
@if %{CustomNamespace}
C_NAMESPACE("%{CustomNamespaceValue}")
@endif
public:
explicit %{CN}(QObject *parent = 0);
C_ATTR(index, :Path)
void index(Context *c);
private Q_SLOTS:
@if %{BeginMethod}
bool Begin(Context *c) override;
@endif
@if %{AutoMethod}
bool Auto(Context *c) override;
@endif
@if %{EndMethod}
bool End(Context *c) override;
@endif
};
%{JS: Cpp.closeNamespaces('%{Class}')}
#endif // %{GUARD}\
| %{Cpp:LicenseTemplate}\
#ifndef %{GUARD}
#define %{GUARD}
#include <Cutelyst/Controller>
%{JS: Cpp.openNamespaces('%{Class}')}\
using namespace Cutelyst;
class %{CN} : public Controller
{
Q_OBJECT
@if %{CustomNamespace}
C_NAMESPACE("%{CustomNamespaceValue}")
@endif
public:
explicit %{CN}(QObject *parent = 0);
C_ATTR(index, :Path)
void index(Context *c);
private Q_SLOTS:
@if %{BeginMethod}
bool Begin(Context *c);
@endif
@if %{AutoMethod}
bool Auto(Context *c);
@endif
@if %{EndMethod}
bool End(Context *c);
@endif
};
%{JS: Cpp.closeNamespaces('%{Class}')}
#endif // %{GUARD}\
| Remove override form Begin Auto End methods of QtCreator plugin as they don't override anymore | Remove override form Begin Auto End methods of QtCreator plugin as they don't override anymore
| C | bsd-3-clause | buschmann23/cutelyst,cutelyst/cutelyst,simonaw/cutelyst,buschmann23/cutelyst,buschmann23/cutelyst,cutelyst/cutelyst,cutelyst/cutelyst,simonaw/cutelyst |
0b2b76601a160cc5e38f5c1720084e6b872bc246 | test/CodeGen/struct-matching-constraint.c | test/CodeGen/struct-matching-constraint.c | // RUN: %clang_cc1 -emit-llvm -march=armv7a %s
// XFAIL: *
// XTARGET: arm
typedef struct __simd128_uint16_t
{
__neon_uint16x8_t val;
} uint16x8_t;
void b(uint16x8_t sat, uint16x8_t luma)
{
__asm__("vmov.16 %1, %0 \n\t"
"vtrn.16 %0, %1 \n\t"
:"=w"(luma), "=w"(sat)
:"0"(luma)
);
}
| // RUN: %clang -S -emit-llvm -arch arm -march=armv7a %s
typedef unsigned short uint16_t;
typedef __attribute__((neon_vector_type(8))) uint16_t uint16x8_t;
void b(uint16x8_t sat, uint16x8_t luma)
{
__asm__("vmov.16 %1, %0 \n\t"
"vtrn.16 %0, %1 \n\t"
:"=w"(luma), "=w"(sat)
:"0"(luma)
);
}
| Fix this test to work for arm and on all platforms. | Fix this test to work for arm and on all platforms.
git-svn-id: ffe668792ed300d6c2daa1f6eba2e0aa28d7ec6c@136307 91177308-0d34-0410-b5e6-96231b3b80d8
| C | apache-2.0 | llvm-mirror/clang,llvm-mirror/clang,llvm-mirror/clang,llvm-mirror/clang,apple/swift-clang,apple/swift-clang,llvm-mirror/clang,apple/swift-clang,apple/swift-clang,llvm-mirror/clang,apple/swift-clang,llvm-mirror/clang,apple/swift-clang,llvm-mirror/clang,apple/swift-clang,llvm-mirror/clang,apple/swift-clang,apple/swift-clang,llvm-mirror/clang,apple/swift-clang |
7ae187e075b4b6678732b1b82e3d4c59ed5f8dcc | src/popover/main.c | src/popover/main.c | /*
* This file is part of ui-tests
*
* Copyright © 2016 Ikey Doherty <[email protected]>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*/
#include "util.h"
#include <stdlib.h>
BUDGIE_BEGIN_PEDANTIC
#include "popover.h"
BUDGIE_END_PEDANTIC
int main(int argc, char **argv)
{
gtk_init(&argc, &argv);
return EXIT_FAILURE;
}
/*
* Editor modelines - https://www.wireshark.org/tools/modelines.html
*
* Local variables:
* c-basic-offset: 8
* tab-width: 8
* indent-tabs-mode: nil
* End:
*
* vi: set shiftwidth=8 tabstop=8 expandtab:
* :indentSize=8:tabSize=8:noTabs=true:
*/
| /*
* This file is part of ui-tests
*
* Copyright © 2016 Ikey Doherty <[email protected]>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*/
#include "util.h"
#include <stdlib.h>
BUDGIE_BEGIN_PEDANTIC
#include "popover.h"
BUDGIE_END_PEDANTIC
int main(int argc, char **argv)
{
gtk_init(&argc, &argv);
GtkWidget *window = NULL;
window = budgie_popover_new();
g_signal_connect(window, "destroy", gtk_main_quit, NULL);
gtk_widget_show_all(window);
gtk_main();
return EXIT_SUCCESS;
}
/*
* Editor modelines - https://www.wireshark.org/tools/modelines.html
*
* Local variables:
* c-basic-offset: 8
* tab-width: 8
* indent-tabs-mode: nil
* End:
*
* vi: set shiftwidth=8 tabstop=8 expandtab:
* :indentSize=8:tabSize=8:noTabs=true:
*/
| Make the demo use the popover | Make the demo use the popover
Signed-off-by: Ikey Doherty <[email protected]>
| C | lgpl-2.1 | ikeydoherty/ui-tests,ikeydoherty/ui-tests |
504905fd4b5334c8763fa4b9c61e618fa68d4b8b | include/llvm/Target/TargetMachineImpls.h | include/llvm/Target/TargetMachineImpls.h | //===-- llvm/Target/TargetMachineImpls.h - Target Descriptions --*- C++ -*-===//
//
// This file defines the entry point to getting access to the various target
// machine implementations available to LLVM.
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_TARGET_TARGETMACHINEIMPLS_H
#define LLVM_TARGET_TARGETMACHINEIMPLS_H
namespace TM {
enum {
PtrSizeMask = 1,
PtrSize32 = 0,
PtrSize64 = 1,
EndianMask = 2,
LittleEndian = 0,
BigEndian = 2,
};
}
class TargetMachine;
// allocateSparcTargetMachine - Allocate and return a subclass of TargetMachine
// that implements the Sparc backend.
//
TargetMachine *allocateSparcTargetMachine();
// allocateX86TargetMachine - Allocate and return a subclass of TargetMachine
// that implements the X86 backend. The X86 target machine can run in
// "emulation" mode, where it is capable of emulating machines of larger pointer
// size and different endianness if desired.
//
TargetMachine *allocateX86TargetMachine(unsigned Configuration =
TM::PtrSize32|TM::LittleEndian);
#endif
| //===-- llvm/Target/TargetMachineImpls.h - Target Descriptions --*- C++ -*-===//
//
// This file defines the entry point to getting access to the various target
// machine implementations available to LLVM.
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_TARGET_TARGETMACHINEIMPLS_H
#define LLVM_TARGET_TARGETMACHINEIMPLS_H
namespace TM {
enum {
PtrSizeMask = 1,
PtrSize32 = 0,
PtrSize64 = 1,
EndianMask = 2,
LittleEndian = 0,
BigEndian = 2,
};
}
class TargetMachine;
// allocateSparcTargetMachine - Allocate and return a subclass of TargetMachine
// that implements the Sparc backend.
//
TargetMachine *allocateSparcTargetMachine(unsigned Configuration =
TM::PtrSize64|TM::BigEndian);
// allocateX86TargetMachine - Allocate and return a subclass of TargetMachine
// that implements the X86 backend. The X86 target machine can run in
// "emulation" mode, where it is capable of emulating machines of larger pointer
// size and different endianness if desired.
//
TargetMachine *allocateX86TargetMachine(unsigned Configuration =
TM::PtrSize32|TM::LittleEndian);
#endif
| Allow allocation of a Sparc TargetMachine. | Allow allocation of a Sparc TargetMachine.
git-svn-id: 0ff597fd157e6f4fc38580e8d64ab130330d2411@6364 91177308-0d34-0410-b5e6-96231b3b80d8
| C | apache-2.0 | GPUOpen-Drivers/llvm,llvm-mirror/llvm,dslab-epfl/asap,chubbymaggie/asap,dslab-epfl/asap,dslab-epfl/asap,apple/swift-llvm,GPUOpen-Drivers/llvm,apple/swift-llvm,apple/swift-llvm,apple/swift-llvm,GPUOpen-Drivers/llvm,GPUOpen-Drivers/llvm,llvm-mirror/llvm,dslab-epfl/asap,llvm-mirror/llvm,chubbymaggie/asap,llvm-mirror/llvm,apple/swift-llvm,chubbymaggie/asap,GPUOpen-Drivers/llvm,chubbymaggie/asap,dslab-epfl/asap,llvm-mirror/llvm,llvm-mirror/llvm,GPUOpen-Drivers/llvm,llvm-mirror/llvm,apple/swift-llvm,dslab-epfl/asap,llvm-mirror/llvm,dslab-epfl/asap,apple/swift-llvm,apple/swift-llvm,chubbymaggie/asap,llvm-mirror/llvm,GPUOpen-Drivers/llvm,GPUOpen-Drivers/llvm,chubbymaggie/asap |
4f923d491c12d654a0e8ac7101c93dccf5ac9ba5 | sipXmediaLib/include/mp/MpIntResourceMsg.h | sipXmediaLib/include/mp/MpIntResourceMsg.h | //
// Copyright (C) 2008 SIPez LLC.
// Licensed to SIPfoundry under a Contributor Agreement.
//
// Copyright (C) 2008 SIPfoundry Inc.
// Licensed by SIPfoundry under the LGPL license.
//
// $$
///////////////////////////////////////////////////////////////////////////////
#ifndef _MpIntResourceMsg_h_
#define _MpIntResourceMsg_h_
// SYSTEM INCLUDES
// APPLICATION INCLUDES
#include "mp/MpResourceMsg.h"
// DEFINES
// MACROS
// EXTERNAL FUNCTIONS
// EXTERNAL VARIABLES
// CONSTANTS
// STRUCTS
// TYPEDEFS
// FORWARD DECLARATIONS
/// Message used to pass an integer value to resource.
class MpIntResourceMsg : public MpResourceMsg
{
/* //////////////////////////// PUBLIC //////////////////////////////////// */
public:
/* ============================ CREATORS ================================== */
///@name Creators
//@{
/// Constructor
MpIntResourceMsg(MpResourceMsgType type,
const UtlString& targetResourceName,
int data)
: MpResourceMsg(type, targetResourceName)
, mData(data)
{
};
/// Copy constructor
MpIntResourceMsg(const MpIntResourceMsg &msg)
: MpResourceMsg(msg)
, mData(msg.mData)
{
};
/// @copydoc MpResourceMsg::createCopy()
OsMsg* createCopy() const
{
return new MpIntResourceMsg(*this);
}
//@}
/* ============================ MANIPULATORS ============================== */
///@name Manipulators
//@{
/// Assignment operator
MpIntResourceMsg& operator=(const MpIntResourceMsg& rhs)
{
if(&rhs == this)
{
return(*this);
}
MpResourceMsg::operator=(rhs);
mData = rhs.mData;
return *this;
}
//@}
/* ============================ ACCESSORS ================================= */
///@name Accessors
//@{
/// Return contained integer.
int getData() const {return mData;}
//@}
/* ============================ INQUIRY =================================== */
///@name Inquiry
//@{
//@}
/* //////////////////////////// PROTECTED ///////////////////////////////// */
protected:
/* //////////////////////////// PRIVATE /////////////////////////////////// */
private:
int mData; ///< Integer to be passed to resource.
};
/* ============================ INLINE METHODS ============================ */
#endif // _MpIntResourceMsg_h_
| Add resource message bearing some abstract integer. | Add resource message bearing some abstract integer.
git-svn-id: f26ccc5efe72c2bd8e1c40f599fe313f2692e4de@10873 a612230a-c5fa-0310-af8b-88eea846685b
| C | lgpl-2.1 | sipXtapi/sipXtapi-svn-mirror,sipXtapi/sipXtapi-svn-mirror,sipXtapi/sipXtapi-svn-mirror,sipXtapi/sipXtapi-svn-mirror,sipXtapi/sipXtapi-svn-mirror,sipXtapi/sipXtapi-svn-mirror,sipXtapi/sipXtapi-svn-mirror |
|
63ca5179dd60983527d17a31c0e44e0a3be5124f | MdePkg/Include/Guid/MemoryAttributesTable.h | MdePkg/Include/Guid/MemoryAttributesTable.h | /** @file
GUIDs used for UEFI Memory Attributes Table in the UEFI 2.6 specification.
Copyright (c) 2016, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#ifndef __UEFI_MEMORY_ATTRIBUTES_TABLE_H__
#define __UEFI_MEMORY_ATTRIBUTES_TABLE_H__
#define EFI_MEMORY_ATTRIBUTES_TABLE_GUID {\
0xdcfa911d, 0x26eb, 0x469f, {0xa2, 0x20, 0x38, 0xb7, 0xdc, 0x46, 0x12, 0x20} \
}
typedef struct {
UINT32 Version;
UINT32 NumberOfEntries;
UINT32 DescriptorSize;
UINT32 Reserved;
//EFI_MEMORY_DESCRIPTOR Entry[1];
} EFI_MEMORY_ATTRIBUTES_TABLE;
#define EFI_MEMORY_ATTRIBUTES_TABLE_VERSION 0x00000001
extern EFI_GUID gEfiMemoryAttributesTableGuid;
#endif
| Add UEFI2.6 MemoryAttributes Table definition. | MdePkg: Add UEFI2.6 MemoryAttributes Table definition.
Add UEFI2.6 MemoryAttributes Table definition header
file.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: "Yao, Jiewen" <[email protected]>
Reviewed-by: "Gao, Liming" <[email protected]>
| C | bsd-2-clause | MattDevo/edk2,MattDevo/edk2,MattDevo/edk2,MattDevo/edk2,MattDevo/edk2,MattDevo/edk2,MattDevo/edk2,MattDevo/edk2 |
|
5869dc005e829ed07b066746b01d24f264a47113 | test/FrontendC/pr5406.c | test/FrontendC/pr5406.c | // RUN: %llvmgcc %s -S -emit-llvm -O0 -o - | FileCheck %s
// PR 5406
// XFAIL: *
// XTARGET: arm
typedef struct { char x[3]; } A0;
void foo (int i, ...);
// CHECK: call arm_aapcscc void (i32, ...)* @foo(i32 1, i32 {{.*}}) nounwind
int main (void)
{
A0 a3;
a3.x[0] = 0;
a3.x[0] = 0;
a3.x[2] = 26;
foo (1, a3 );
return 0;
}
| // RUN: %llvmgcc %s -S -emit-llvm -O0 -o - | FileCheck %s
// PR 5406
// XFAIL: *
// XTARGET: arm
typedef struct { char x[3]; } A0;
void foo (int i, ...);
// CHECK: call void (i32, ...)* @foo(i32 1, i32 {{.*}}) nounwind
int main (void)
{
A0 a3;
a3.x[0] = 0;
a3.x[0] = 0;
a3.x[2] = 26;
foo (1, a3 );
return 0;
}
| Update test to match recent llvm-gcc change. | Update test to match recent llvm-gcc change.
git-svn-id: 0ff597fd157e6f4fc38580e8d64ab130330d2411@106056 91177308-0d34-0410-b5e6-96231b3b80d8
| C | bsd-2-clause | dslab-epfl/asap,llvm-mirror/llvm,apple/swift-llvm,llvm-mirror/llvm,llvm-mirror/llvm,apple/swift-llvm,dslab-epfl/asap,chubbymaggie/asap,llvm-mirror/llvm,GPUOpen-Drivers/llvm,llvm-mirror/llvm,chubbymaggie/asap,apple/swift-llvm,dslab-epfl/asap,dslab-epfl/asap,GPUOpen-Drivers/llvm,chubbymaggie/asap,apple/swift-llvm,apple/swift-llvm,apple/swift-llvm,llvm-mirror/llvm,chubbymaggie/asap,chubbymaggie/asap,GPUOpen-Drivers/llvm,llvm-mirror/llvm,GPUOpen-Drivers/llvm,GPUOpen-Drivers/llvm,llvm-mirror/llvm,GPUOpen-Drivers/llvm,dslab-epfl/asap,llvm-mirror/llvm,apple/swift-llvm,chubbymaggie/asap,apple/swift-llvm,dslab-epfl/asap,GPUOpen-Drivers/llvm,dslab-epfl/asap,GPUOpen-Drivers/llvm |
630a77010f67c64a224c4408ef8650c591280779 | tests/ExperimentSuite.h | tests/ExperimentSuite.h | #include <cxxtest/TestSuite.h>
#include "../log/EyeLog.h"
class ExperimentSuite: public CxxTest::TestSuite
{
public:
bool entryVecsAreEqual(const PEntryVec& v1, const PEntryVec& v2)
{
if (v1.size() != v2.size())
return false;
for (auto i = PEntryVec::size_type(0); i < v1.size(); i++) {
if (v1[i]->compare(*v2[i]) != 0)
return false;
}
return true;
}
void testMetaComparison()
{
TS_TRACE("Testing PExperiment comparisons");
PEntryVec meta;
PEntryVec metacp;
meta.push_back(new PGazeEntry(LGAZE, 0, 10, 10, 0));
meta.push_back(new PGazeEntry(RGAZE, 0, 10, 10, 0));
meta.push_back(new PGazeEntry(LGAZE, 1, 10, 10, 0));
meta.push_back(new PGazeEntry(RGAZE, 1, 10, 10, 0));
meta.push_back(new PMessageEntry(2, "Hi"));
metacp = copyPEntryVec(meta);
PExperiment expmeta (meta);
PExperiment expmetacp(metacp);
// Test whether two identical are identical
TS_ASSERT_EQUALS(expmeta, expmetacp);
metacp.push_back(new PTrialEntry());
// Test whether a length difference compares as unequal
TS_ASSERT_DIFFERS(expmeta, PExperiment(metacp));
destroyPEntyVec(metacp);
metacp = copyPEntryVec(meta);
delete metacp[3];
// note that in the next the pupil size if different
metacp[3] = new PGazeEntry(RGAZE, 1, 10, 10, 1);
TS_ASSERT_DIFFERS(expmeta, PExperiment(metacp));
destroyPEntyVec(metacp);
destroyPEntyVec(meta);
}
};
| Add ExperimentSuit to test PExperment and PTrial | Add ExperimentSuit to test PExperment and PTrial
| C | lgpl-2.1 | UiL-OTS-labs/libeye,UiL-OTS-labs/libeye,UiL-OTS-labs/libeye |
|
d4c28b0d467d667632489fa8f14d597f85a90f05 | src/bin/e_signals.c | src/bin/e_signals.c | /*
* vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
*/
#include "e.h"
#include <execinfo.h>
/* a tricky little devil, requires e and it's libs to be built
* with the -rdynamic flag to GCC for any sort of decent output.
*/
void e_sigseg_act(int x, siginfo_t *info, void *data){
void *array[255];
size_t size;
write(2, "**** SEGMENTATION FAULT ****\n", 29);
write(2, "**** Printing Backtrace... *****\n\n", 34);
size = backtrace(array, 255);
backtrace_symbols_fd(array, size, 2);
exit(-11);
}
| /*
* vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
* NOTE TO FreeBSD users. Install libexecinfo from
* ports/devel/libexecinfo and add -lexecinfo to LDFLAGS
* to add backtrace support.
*/
#include "e.h"
#include <execinfo.h>
/* a tricky little devil, requires e and it's libs to be built
* with the -rdynamic flag to GCC for any sort of decent output.
*/
void e_sigseg_act(int x, siginfo_t *info, void *data){
void *array[255];
size_t size;
write(2, "**** SEGMENTATION FAULT ****\n", 29);
write(2, "**** Printing Backtrace... *****\n\n", 34);
size = backtrace(array, 255);
backtrace_symbols_fd(array, size, 2);
exit(-11);
}
| Add note to help FreeBSD users. | Add note to help FreeBSD users.
git-svn-id: 0f3f1c46c6da7ffd142db61e503a7ff63af3a195@13781 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33
| C | bsd-2-clause | jordemort/e17,jordemort/e17,jordemort/e17 |
d1c5ca9d6c830a597ebdeaaadb73254b265f647b | source/common/d3d_util.h | source/common/d3d_util.h | /* The Halfling Project - A Graphics Engine and Projects
*
* The Halfling Project is the legal property of Adrian Astley
* Copyright Adrian Astley 2013
*/
#ifndef COMMON_D3D_UTIL_H
#define COMMON_D3D_UTIL_H
#include "common/dxerr.h"
//---------------------------------------------------------------------------------------
// Simple d3d error checker
//---------------------------------------------------------------------------------------
#if defined(DEBUG) | defined(_DEBUG)
#ifndef HR
#define HR(x) { \
HRESULT hr = (x); \
if (FAILED(hr)) { \
DXTrace(__FILEW__, (DWORD)__LINE__, hr, L#x, true); \
} \
}
#endif
#else
#ifndef HR
#define HR(x) (x)
#endif
#endif
//---------------------------------------------------------------------------------------
// Convenience macro for releasing COM objects.
//---------------------------------------------------------------------------------------
#define ReleaseCOM(x) { if(x){ x->Release(); x = 0; } }
#endif
| /* The Halfling Project - A Graphics Engine and Projects
*
* The Halfling Project is the legal property of Adrian Astley
* Copyright Adrian Astley 2013
*/
#ifndef COMMON_D3D_UTIL_H
#define COMMON_D3D_UTIL_H
#include "common/dxerr.h"
//---------------------------------------------------------------------------------------
// Simple d3d error checker
//---------------------------------------------------------------------------------------
#if defined(DEBUG) | defined(_DEBUG)
#ifndef HR
#define HR(x) { \
HRESULT hr = (x); \
if (FAILED(hr)) { \
DXTrace(__FILEW__, (DWORD)__LINE__, hr, L#x, true); \
} \
}
#endif
#else
#ifndef HR
#define HR(x) (x)
#endif
#endif
//---------------------------------------------------------------------------------------
// Convenience macro for releasing COM objects.
//---------------------------------------------------------------------------------------
#define ReleaseCOM(x) { if(x){ x->Release(); x = nullptr; } }
#endif
| Use nullptr instead of 0 | COMMON: Use nullptr instead of 0
| C | apache-2.0 | RichieSams/thehalflingproject,RichieSams/thehalflingproject,RichieSams/thehalflingproject |
050cf2fe7cc047b55d81a5b9d38bcc1a63225e13 | base/include/mem.h | base/include/mem.h |
size_t align_to(size_t offset, size_t align);
|
#define container_of(p,T,memb) (T *)((char *)(p) - offsetof(T,member))
#define length_of(array) (sizeof (array) / sizeof 0[array])
size_t align_to(size_t offset, size_t align);
| Add container_of and length_of macros to base | Add container_of and length_of macros to base
| C | isc | cventus/otivm,cventus/otivm,cventus/otivm |
13a7868be57942e1e27bf9767a2cd85a4a0b288d | lib/debug_msg.c | lib/debug_msg.c | /**
* @file debug_msg.c Debug Message function
*/
/* $Id$ */
#include "gangliaconf.h"
int debug_level = 0;
/**
* @fn void debug_msg(const char *format, ...)
* Prints the message to STDERR if DEBUG is #defined
* @param format The format of the msg (see printf manpage)
* @param ... Optional arguments
*/
void
debug_msg(const char *format, ...)
{
if (debug_level && format)
{
va_list ap;
va_start(ap, format);
vfprintf(stderr, format, ap);
fprintf(stderr,"\n");
va_end(ap);
}
return;
}
| /**
* @file debug_msg.c Debug Message function
*/
/* $Id$ */
#include "gangliaconf.h"
int debug_level = 0;
/**
* @fn void debug_msg(const char *format, ...)
* Prints the message to STDERR if DEBUG is #defined
* @param format The format of the msg (see printf manpage)
* @param ... Optional arguments
*/
void
debug_msg(const char *format, ...)
{
if (debug_level > 1 && format)
{
va_list ap;
va_start(ap, format);
vfprintf(stderr, format, ap);
fprintf(stderr,"\n");
va_end(ap);
}
return;
}
| Debug level 1 now only shows error messages (and no backgrounding in gmetad). | Debug level 1 now only shows error messages (and no backgrounding in gmetad).
git-svn-id: 27e0aca8c7a52a9ae65dfba2e16879604119af8c@188 93a4e39c-3214-0410-bb16-828d8e3bcd0f
| C | bsd-3-clause | fastly/ganglia,fastly/ganglia,fastly/ganglia,fastly/ganglia,fastly/ganglia |
d1db59b4fa389e5f73ae9de7c4f75802102d1756 | fmpz_poly_factor/clear.c | fmpz_poly_factor/clear.c | /*
Copyright (C) 2011 Sebastian Pancratz
This file is part of FLINT.
FLINT is free software: you can redistribute it and/or modify it under
the terms of the GNU Lesser General Public License (LGPL) as published
by the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version. See <http://www.gnu.org/licenses/>.
*/
#include <gmp.h>
#include <stdlib.h>
#include "flint.h"
#include "fmpz.h"
#include "fmpz_poly.h"
void fmpz_poly_factor_clear(fmpz_poly_factor_t fac)
{
if (fac->alloc)
{
slong i;
for (i = 0; i < fac->alloc; i++)
{
fmpz_poly_clear(fac->p + i);
}
fmpz_clear(&(fac->c));
flint_free(fac->p);
flint_free(fac->exp);
fac->p = NULL;
fac->exp = NULL;
}
}
| /*
Copyright (C) 2011 Sebastian Pancratz
This file is part of FLINT.
FLINT is free software: you can redistribute it and/or modify it under
the terms of the GNU Lesser General Public License (LGPL) as published
by the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version. See <http://www.gnu.org/licenses/>.
*/
#include <gmp.h>
#include <stdlib.h>
#include "flint.h"
#include "fmpz.h"
#include "fmpz_poly.h"
void fmpz_poly_factor_clear(fmpz_poly_factor_t fac)
{
if (fac->alloc)
{
slong i;
for (i = 0; i < fac->alloc; i++)
{
fmpz_poly_clear(fac->p + i);
}
flint_free(fac->p);
flint_free(fac->exp);
fac->p = NULL;
fac->exp = NULL;
}
fmpz_clear(&(fac->c));
}
| Fix a memory leak in t-factor. | Fix a memory leak in t-factor.
| C | lgpl-2.1 | fredrik-johansson/flint2,wbhart/flint2,wbhart/flint2,fredrik-johansson/flint2,fredrik-johansson/flint2,wbhart/flint2 |
aacb03000dad63a8f336e18ed2a9e8179f5bbc33 | UnitTests/Source/GITTreeEntryTests.h | UnitTests/Source/GITTreeEntryTests.h | //
// GITTreeEntryTests.h
// CocoaGit
//
// Created by Geoffrey Garside on 06/10/2008.
// Copyright 2008 ManicPanda.com. All rights reserved.
//
#import <SenTestingKit/SenTestingKit.h>
@class GITRepo, GITTree;
@interface GITTreeEntryTests : GHTestCase {
GITRepo * repo;
GITTree * tree;
NSUInteger entryMode;
NSString * entryName;
NSString * entrySHA1;
NSString * entryLine;
}
@property(readwrite,retain) GITRepo * repo;
@property(readwrite,retain) GITTree * tree;
@property(readwrite,assign) NSUInteger entryMode;
@property(readwrite,copy) NSString * entryName;
@property(readwrite,copy) NSString * entrySHA1;
@property(readwrite,copy) NSString * entryLine;
- (void)testShouldParseEntryLine;
- (void)testShouldInitWithModeNameAndHash;
- (void)testShouldInitWithModeStringNameAndHash;
@end
| //
// GITTreeEntryTests.h
// CocoaGit
//
// Created by Geoffrey Garside on 06/10/2008.
// Copyright 2008 ManicPanda.com. All rights reserved.
//
#import <GHUnit/GHUnit.h>
@class GITRepo, GITTree;
@interface GITTreeEntryTests : GHTestCase {
GITRepo * repo;
GITTree * tree;
NSUInteger entryMode;
NSString * entryName;
NSString * entrySHA1;
NSString * entryLine;
}
@property(readwrite,retain) GITRepo * repo;
@property(readwrite,retain) GITTree * tree;
@property(readwrite,assign) NSUInteger entryMode;
@property(readwrite,copy) NSString * entryName;
@property(readwrite,copy) NSString * entrySHA1;
@property(readwrite,copy) NSString * entryLine;
- (void)testShouldParseEntryLine;
- (void)testShouldInitWithModeNameAndHash;
- (void)testShouldInitWithModeStringNameAndHash;
@end
| Update GITTreeEntry tests to use GHUnit framework instead of SenTestKit | Update GITTreeEntry tests to use GHUnit framework instead of SenTestKit
| C | mit | schacon/cocoagit,schacon/cocoagit,geoffgarside/cocoagit,geoffgarside/cocoagit |
2067da7189ec2e5d0266e16578b156f6a6bbf215 | src/udon2xml.c | src/udon2xml.c | #include <stdio.h>
#include <stdlib.h>
#include "udon.h"
int main (int argc, char *argv[]) {
int i;
int found = 0;
if(argc < 2) return 1;
UdonParser *udon = udon_new_parser_from_file(argv[1]);
if(udon == NULL) {
udon_emit_error(stderr);
return udon_error_value();
}
for(i=0; i<10000; i++) {
found += udon_parse(udon);
udon_reset_parser(udon);
}
udon_free_parser(udon);
printf("%d\n", found);
}
| #include <stdio.h>
#include <stdlib.h>
#include "udon.h"
int main (int argc, char *argv[]) {
int i;
if(argc < 2) return 1;
UdonParser *udon = udon_new_parser_from_file(argv[1]);
if(udon == NULL) {
udon_emit_error(stderr);
return udon_error_value();
}
int res = udon_parse(udon);
if(res) udon_emit_error(stderr);
udon_reset_parser(udon);
udon_free_parser(udon);
return res;
}
| Remove older benchmarking loop and do correct error handling with real parse interface. | Remove older benchmarking loop and do correct error handling with real parse
interface.
| C | mit | josephwecker/udon-c,josephwecker/udon-c,josephwecker/udon-c,josephwecker/udon-c |
8f3b833e42653e798a6cf6d9f5819677ea8b8e47 | support/utilgen.c | support/utilgen.c | /* Generate a package from system header definitions
-- Copyright (C) 2011 Stephane Carrez
-- Written by Stephane Carrez ([email protected])
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
*/
#include <stdio.h>
#include <unistd.h>
#include <fcntl.h>
int main(void)
{
printf("-- Generated by utildgen.c from system bfd.h\n");
printf("with Interfaces.C;\n");
printf("package Util.Systems.Constants is\n");
printf("\n");
printf("\n -- Flags used when opening a file with open/creat.\n");
printf(" O_RDONLY : constant Interfaces.C.int := 8#%06o#;\n", O_RDONLY);
printf(" O_WRONLY : constant Interfaces.C.int := 8#%06o#;\n", O_WRONLY);
printf(" O_RDWR : constant Interfaces.C.int := 8#%06o#;\n", O_RDWR);
printf(" O_CREAT : constant Interfaces.C.int := 8#%06o#;\n", O_CREAT);
printf(" O_EXCL : constant Interfaces.C.int := 8#%06o#;\n", O_EXCL);
printf(" O_TRUNC : constant Interfaces.C.int := 8#%06o#;\n", O_TRUNC);
printf(" O_APPEND : constant Interfaces.C.int := 8#%06o#;\n", O_APPEND);
printf("\n");
printf(" -- Flags used by fcntl\n");
printf(" F_SETFL : constant Interfaces.C.int := %d;\n", F_SETFL);
printf(" FD_CLOEXEC : constant Interfaces.C.int := %d;\n", FD_CLOEXEC);
printf("\n");
printf("end Util.Systems.Constants;\n");
return 0;
}
| Add a support tool to generate Util.Systems.Constants package | Add a support tool to generate Util.Systems.Constants package
| C | apache-2.0 | Letractively/ada-util,flottokarotto/ada-util,Letractively/ada-util,flottokarotto/ada-util |
|
c9996dfdabcc6e4639240ec90ac3a97912b686ec | utils/lstopo-xml.c | utils/lstopo-xml.c | /*
* Copyright © 2009 CNRS
* Copyright © 2009-2010 INRIA. All rights reserved.
* Copyright © 2009 Université Bordeaux 1
* Copyright © 2009-2011 Cisco Systems, Inc. All rights reserved.
* See COPYING in top-level directory.
*/
#include <private/autogen/config.h>
#ifdef HWLOC_HAVE_XML
#include <hwloc.h>
#include <string.h>
#include "lstopo.h"
void output_xml(hwloc_topology_t topology, const char *filename, int logical __hwloc_attribute_unused, int legend __hwloc_attribute_unused, int verbose_mode __hwloc_attribute_unused)
{
if (!filename || !strcasecmp(filename, "-.xml"))
filename = "-";
hwloc_topology_export_xml(topology, filename);
}
#endif /* HWLOC_HAVE_XML */
| /*
* Copyright © 2009 CNRS
* Copyright © 2009-2010 INRIA. All rights reserved.
* Copyright © 2009 Université Bordeaux 1
* Copyright © 2009-2011 Cisco Systems, Inc. All rights reserved.
* See COPYING in top-level directory.
*/
#include <private/autogen/config.h>
#ifdef HWLOC_HAVE_XML
#include <hwloc.h>
#include <string.h>
#include "lstopo.h"
void output_xml(hwloc_topology_t topology, const char *filename, int logical __hwloc_attribute_unused, int legend __hwloc_attribute_unused, int verbose_mode __hwloc_attribute_unused)
{
if (!filename || !strcasecmp(filename, "-.xml"))
filename = "-";
if (hwloc_topology_export_xml(topology, filename) < 0) {
fprintf(stderr, "Failed to export XML to %s (%s)\n", filename, strerror(errno));
return;
}
}
#endif /* HWLOC_HAVE_XML */
| Print an error when lstopo fails to export to XML | Print an error when lstopo fails to export to XML
git-svn-id: 14be032f8f42541b1a281b51ae8ea69814daf20e@3691 4b44e086-7f34-40ce-a3bd-00e031736276
| C | bsd-3-clause | BlueBrain/hwloc,BlueBrain/hwloc,BlueBrain/hwloc,BlueBrain/hwloc |
eaa2b2534e5d7115be1d5d9efcfe1ce28e0b0721 | fast-xattr-test/fast-xattr-test/main.c | fast-xattr-test/fast-xattr-test/main.c | //
// main.c
// fast-xattr-test
//
// Created by David Schlachter on 2015-07-09.
// Copyright (c) 2015 David Schlachter. All rights reserved.
//
#include <stdio.h>
int main(int argc, const char * argv[]) {
// insert code here...
printf("Hello, World!\n");
return 0;
}
| //
// main.c
// fast-xattr-test
//
// Created by David Schlachter on 2015-07-09.
// Copyright (c) 2015 David Schlachter. All rights reserved.
//
#include <stdio.h>
#include <sys/xattr.h>
#include <stdlib.h>
int main(int argc, const char * argv[]) {
const char *path;
const char *name;
void *value = malloc(15);
size_t size;
u_int32_t position;
int options = 0;
path = argv[1];
name = argv[2];
size = 14;
position = 0;
if (!getxattr(path, name, value, size, position, options)) {
return 0;
} else {
return 1;
};
}
| Set up the getxattr function | Set up the getxattr function
| C | mit | davidschlachter/fast-xattr-test |
49fef60bc607ebb56b979b78f157b31619fea2eb | test/regression/filter-badenc-segv.c | test/regression/filter-badenc-segv.c | #include <stdio.h>
#include <stdlib.h>
#include <parserutils/parserutils.h>
#include "input/filter.h"
#include "testutils.h"
static void *myrealloc(void *ptr, size_t len, void *pw)
{
UNUSED(pw);
return realloc(ptr, len);
}
int main(int argc, char **argv)
{
parserutils_filter *input;
parserutils_filter_optparams params;
if (argc != 2) {
printf("Usage: %s <filename>\n", argv[0]);
return 1;
}
assert(parserutils_initialise(argv[1], myrealloc, NULL) ==
PARSERUTILS_OK);
assert(parserutils_filter_create("UTF-8", myrealloc, NULL, &input) ==
PARSERUTILS_OK);
params.encoding.name = "GBK";
assert(parserutils_filter_setopt(input,
PARSERUTILS_FILTER_SET_ENCODING, ¶ms) ==
PARSERUTILS_BADENCODING);
params.encoding.name = "GBK";
assert(parserutils_filter_setopt(input,
PARSERUTILS_FILTER_SET_ENCODING, ¶ms) ==
PARSERUTILS_BADENCODING);
parserutils_filter_destroy(input);
assert(parserutils_finalise(myrealloc, NULL) == PARSERUTILS_OK);
printf("PASS\n");
return 0;
}
| #include <stdio.h>
#include <stdlib.h>
#include <parserutils/parserutils.h>
#include "input/filter.h"
#include "testutils.h"
static void *myrealloc(void *ptr, size_t len, void *pw)
{
UNUSED(pw);
return realloc(ptr, len);
}
int main(int argc, char **argv)
{
parserutils_filter *input;
parserutils_filter_optparams params;
parserutils_error expected;
#ifdef WITH_ICONV_FILTER
expected = PARSERUTILS_OK;
#else
expected = PARSERUTILS_BADENCODING;
#endif
if (argc != 2) {
printf("Usage: %s <filename>\n", argv[0]);
return 1;
}
assert(parserutils_initialise(argv[1], myrealloc, NULL) ==
PARSERUTILS_OK);
assert(parserutils_filter_create("UTF-8", myrealloc, NULL, &input) ==
PARSERUTILS_OK);
params.encoding.name = "GBK";
assert(parserutils_filter_setopt(input,
PARSERUTILS_FILTER_SET_ENCODING, ¶ms) ==
expected);
params.encoding.name = "GBK";
assert(parserutils_filter_setopt(input,
PARSERUTILS_FILTER_SET_ENCODING, ¶ms) ==
expected);
parserutils_filter_destroy(input);
assert(parserutils_finalise(myrealloc, NULL) == PARSERUTILS_OK);
printf("PASS\n");
return 0;
}
| Fix regression test to work with iconv filter enabled | Fix regression test to work with iconv filter enabled
svn path=/trunk/libparserutils/; revision=5662
| C | mit | servo/libparserutils,dunkelstern/libparserutils,servo/libparserutils,servo/libparserutils,dunkelstern/libparserutils,dunkelstern/libparserutils |
8012d2842d234a838b2ff27c27c5222a665cf7f7 | src/UserSpaceInstrumentation/include/UserSpaceInstrumentation/Attach.h | src/UserSpaceInstrumentation/include/UserSpaceInstrumentation/Attach.h | // Copyright (c) 2021 The Orbit Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef USER_SPACE_INSTRUMENTATION_ATTACH_H_
#define USER_SPACE_INSTRUMENTATION_ATTACH_H_
#include <sys/types.h>
#include "OrbitBase/Result.h"
namespace orbit_user_space_instrumentation {
[[nodiscard]] ErrorMessageOr<void> AttachAndStopProcess(pid_t pid);
[[nodiscard]] ErrorMessageOr<void> DetachAndContinueProcess(pid_t pid);
} // namespace orbit_user_space_instrumentation
#endif // USER_SPACE_INSTRUMENTATION_ATTACH_H_ | // Copyright (c) 2021 The Orbit Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef USER_SPACE_INSTRUMENTATION_ATTACH_H_
#define USER_SPACE_INSTRUMENTATION_ATTACH_H_
#include <sys/types.h>
#include "OrbitBase/Result.h"
namespace orbit_user_space_instrumentation {
// Attaches to and stops all threads of the process `pid` using `PTRACE_ATTACH`. Being attached to a
// process using this function is a precondition for using any of the tooling provided here.
[[nodiscard]] ErrorMessageOr<void> AttachAndStopProcess(pid_t pid);
// Detaches from all threads of the process `pid` and continues the execution.
[[nodiscard]] ErrorMessageOr<void> DetachAndContinueProcess(pid_t pid);
} // namespace orbit_user_space_instrumentation
#endif // USER_SPACE_INSTRUMENTATION_ATTACH_H_ | Fix missing comment in header. | Fix missing comment in header.
| C | bsd-2-clause | google/orbit,google/orbit,google/orbit,google/orbit |
bda2fe3ebaff006d6ff0c7252940033308020dca | lib/rgph.h | lib/rgph.h | /*-
* Copyright (c) 2015 Alexander Nasonov.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#ifndef RGPH_H_INCLUDED
#define RGPH_H_INCLUDED
#include <rhph_defs.h>
#include <rhph_hash.h>
#include <rhph_graph.h>
#endif /* !RGPH_H_INCLUDED */
| /*-
* Copyright (c) 2015 Alexander Nasonov.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#ifndef RGPH_H_INCLUDED
#define RGPH_H_INCLUDED
#include <rgph_defs.h>
#include <rgph_hash.h>
#include <rgph_graph.h>
#endif /* !RGPH_H_INCLUDED */
| Fix typo in include file names. | Fix typo in include file names.
| C | bsd-2-clause | alnsn/rgph,alnsn/rgph |
02a229b409fe2026efd86c54df9205c907e85ab1 | location.c | location.c | #include "location.h"
#include "inventory.h"
#include "person.h"
void location_init(struct location *location, char *name, char *description)
{
location->name = name;
location->description = description;
inventory_init(&location->inventory);
vector_init(&location->people, sizeof(struct person *));
}
void location_free(struct location *location)
{
for (int i = 0; i < location->people.size; i++) {
person_free(location->people.data[i]);
}
vector_free(&location->people);
inventory_free(&location->inventory);
}
| #include "location.h"
#include "inventory.h"
#include "person.h"
void location_init(struct location *location, char *name, char *description)
{
location->name = name;
location->description = description;
inventory_init(&location->inventory);
vector_init(&location->people, sizeof(struct person *));
}
void location_free(struct location *location)
{
for (int i = 0; i < location->people.size; i++) {
person_free(vector_get(&location->people, i));
}
vector_free(&location->people);
inventory_free(&location->inventory);
}
| Use vector_get rather than accessing array directly | Use vector_get rather than accessing array directly
| C | mit | kouroshp/text-game,kouroshp/text-game |
0be16b56459b7fb7317c8a4a2c750d1b4138ed4a | solutions/uri/1029/1029.c | solutions/uri/1029/1029.c | #include <stdio.h>
#include <string.h>
long int f[39];
long int r[39];
long int fib(long int n) {
if (n == 0) {
return f[0];
}
if (f[n] != 0) {
return f[n];
}
f[n] = fib(n - 1) + fib(n - 2);
r[n] = r[n - 1] + r[n - 2] + 2;
return f[n];
}
int main() {
int i, j;
long int n;
memset(f, 0, sizeof(f));
memset(r, 0, sizeof(r));
f[1] = 1;
scanf("%d", &i);
while (i--) {
scanf("%ld", &n);
printf("fib(%ld) = %ld calls = %ld\n", n, r[n], fib(n));
}
return 0;
}
| Solve Fibonacci, How Many Calls? in c | Solve Fibonacci, How Many Calls? in c
| C | mit | deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playground |
|
c074c99d3e0e4fd133b1300c4cb6acf0efbdf801 | ir/ana2/gnu_ext.h | ir/ana2/gnu_ext.h | /* -*- c -*- */
/*
Project: libFIRM
File name: ir/ana/gnu_ext.c
Purpose: Provide some GNU CC extensions to the rest of the world
Author: Florian
Modified by:
Created: Sat Nov 13 19:35:27 CET 2004
CVS-ID: $Id$
Copyright: (c) 1999-2005 Universitt Karlsruhe
Licence: This file is protected by the GPL - GNU GENERAL PUBLIC LICENSE.
*/
# ifdef HAVE_CONFIG_H
# include "config.h"
# endif
/*
gnu_ext: Provide some GNU CC extensions to the rest of the world
*/
/* Includes */
/* Local Defines: */
# if defined (__GNUC__)
/* then we're all set */
# else /* defined __GNUC__ */
# define __FUNCTION__ "::"
# define __PRETTY_FUNCTION__ ":::"
# endif /* define __GNUC__ */
/* Local Data Types: */
/* Local Variables: */
/* Local Prototypes: */
/* ===================================================
Local Implementation:
=================================================== */
/* ===================================================
Exported Implementation:
=================================================== */
/*
$Log$
Revision 1.1 2005/01/14 14:15:19 liekweg
Support GNU extensions on non-GNU platforms
*/
| Support GNU extensions on non-GNU platforms | Support GNU extensions on non-GNU platforms
[r4924]
| C | lgpl-2.1 | MatzeB/libfirm,MatzeB/libfirm,MatzeB/libfirm,killbug2004/libfirm,MatzeB/libfirm,libfirm/libfirm,davidgiven/libfirm,8l/libfirm,8l/libfirm,libfirm/libfirm,killbug2004/libfirm,jonashaag/libfirm,killbug2004/libfirm,8l/libfirm,davidgiven/libfirm,killbug2004/libfirm,libfirm/libfirm,8l/libfirm,8l/libfirm,jonashaag/libfirm,jonashaag/libfirm,jonashaag/libfirm,davidgiven/libfirm,8l/libfirm,jonashaag/libfirm,MatzeB/libfirm,davidgiven/libfirm,libfirm/libfirm,8l/libfirm,killbug2004/libfirm,davidgiven/libfirm,killbug2004/libfirm,MatzeB/libfirm,davidgiven/libfirm,libfirm/libfirm,MatzeB/libfirm,jonashaag/libfirm,killbug2004/libfirm,davidgiven/libfirm,jonashaag/libfirm |
|
38bcd605bc3a57bf3bd354826e16e41d74d87933 | test.c | test.c | #include <stdio.h>
int main(int argc, char ** argv){
printf("Test\n");
return 0;
}
| #include <stdlib.h>
#include <stdio.h>
int main(int argc, char ** argv){
printf("Test\n");
void* test = malloc(1024*1024);
if(test > 0){
printf("Malloc\n");
free(test);
printf("Free\n");
}else{
printf("Malloc Failed\n");
}
return 0;
}
| Fix bugs with libc, executor | WIP: Fix bugs with libc, executor
| C | mit | redox-os/libc,redox-os/libc,redox-os/libc |
81418d19ccfd34af55de37f16f1dcd9a6111eb2f | kilo.c | kilo.c | #include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
#include <termios.h>
#include <unistd.h>
struct termios orig_termios;
void disable_raw_mode() {
tcsetattr(STDIN_FILENO, TCSAFLUSH, &orig_termios);
}
void enable_raw_mode() {
tcgetattr(STDIN_FILENO, &orig_termios);
atexit(disable_raw_mode);
struct termios raw = orig_termios;
raw.c_iflag &= ~(ICRNL | IXON);
raw.c_oflag &= ~(OPOST);
raw.c_lflag &= ~(ECHO | ICANON | IEXTEN | ISIG);
tcsetattr(STDIN_FILENO, TCSAFLUSH, &raw);
}
int main() {
enable_raw_mode();
char c;
while (read(STDIN_FILENO, &c, 1) == 1 && c != 'q') {
if (iscntrl(c)) {
printf("%d\n", c);
} else {
printf("%d ('%c')\n", c, c);
}
}
return 0;
}
| #include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
#include <termios.h>
#include <unistd.h>
struct termios orig_termios;
void disable_raw_mode() {
tcsetattr(STDIN_FILENO, TCSAFLUSH, &orig_termios);
}
void enable_raw_mode() {
tcgetattr(STDIN_FILENO, &orig_termios);
atexit(disable_raw_mode);
struct termios raw = orig_termios;
raw.c_iflag &= ~(ICRNL | IXON);
raw.c_oflag &= ~(OPOST);
raw.c_lflag &= ~(ECHO | ICANON | IEXTEN | ISIG);
tcsetattr(STDIN_FILENO, TCSAFLUSH, &raw);
}
int main() {
enable_raw_mode();
char c;
while (read(STDIN_FILENO, &c, 1) == 1 && c != 'q') {
if (iscntrl(c)) {
printf("%d\r\n", c);
} else {
printf("%d ('%c')\r\n", c, c);
}
}
return 0;
}
| Fix printf() by adding CR manually | Fix printf() by adding CR manually
| C | bsd-2-clause | oldsharp/kilo,oldsharp/kilo |
e9e7ffa10d1af2f0b11528c1be16ab406c02f136 | runtime/libprofile/LineProfiling.c | runtime/libprofile/LineProfiling.c | /*===- LineProfiling.c - Support library for line profiling ---------------===*\
|*
|* The LLVM Compiler Infrastructure
|*
|* This file is distributed under the University of Illinois Open Source
|* License. See LICENSE.TXT for details.
|*
|*===----------------------------------------------------------------------===*|
|*
|* This file implements the call back routines for the line profiling
|* instrumentation pass. Link against this library when running code through
|* the -insert-line-profiling LLVM pass.
|*
\*===----------------------------------------------------------------------===*/
#include <stdlib.h>
#include <stdio.h>
#include <stdint.h>
/* A file in this case is a translation unit. Each .o file built with line
* profiling enabled will emit to a different file. Only one file may be
* started at a time.
*/
void llvm_prof_linectr_start_file(const char *orig_filename) {
printf("[%s]\n", orig_filename);
}
/* Emit data about a counter to the data file. */
void llvm_prof_linectr_emit_counter(const char *dir, const char *file,
uint32_t line, uint32_t column,
uint64_t *counter) {
printf("%s/%s:%u:%u %lu\n", dir, file, line, column, *counter);
}
void llvm_prof_linectr_end_file() {
printf("-----\n");
}
| /*===- LineProfiling.c - Support library for line profiling ---------------===*\
|*
|* The LLVM Compiler Infrastructure
|*
|* This file is distributed under the University of Illinois Open Source
|* License. See LICENSE.TXT for details.
|*
|*===----------------------------------------------------------------------===*|
|*
|* This file implements the call back routines for the line profiling
|* instrumentation pass. Link against this library when running code through
|* the -insert-line-profiling LLVM pass.
|*
\*===----------------------------------------------------------------------===*/
#include <stdlib.h>
#include <stdio.h>
#include <stdint.h>
#include "llvm/Support/DataTypes.h"
/* A file in this case is a translation unit. Each .o file built with line
* profiling enabled will emit to a different file. Only one file may be
* started at a time.
*/
void llvm_prof_linectr_start_file(const char *orig_filename) {
printf("[%s]\n", orig_filename);
}
/* Emit data about a counter to the data file. */
void llvm_prof_linectr_emit_counter(const char *dir, const char *file,
uint32_t line, uint32_t column,
uint64_t *counter) {
printf("%s/%s:%u:%u %" PRIu64 "\n", dir, file, line, column, *counter);
}
void llvm_prof_linectr_end_file() {
printf("-----\n");
}
| Print our uint64_t with the more portable (C99 and C++0x) %PRIu64 format specifier. | Print our uint64_t with the more portable (C99 and C++0x) %PRIu64 format
specifier.
git-svn-id: 0ff597fd157e6f4fc38580e8d64ab130330d2411@129384 91177308-0d34-0410-b5e6-96231b3b80d8
| C | bsd-2-clause | dslab-epfl/asap,apple/swift-llvm,llvm-mirror/llvm,dslab-epfl/asap,llvm-mirror/llvm,GPUOpen-Drivers/llvm,apple/swift-llvm,apple/swift-llvm,chubbymaggie/asap,dslab-epfl/asap,apple/swift-llvm,chubbymaggie/asap,apple/swift-llvm,GPUOpen-Drivers/llvm,GPUOpen-Drivers/llvm,chubbymaggie/asap,chubbymaggie/asap,GPUOpen-Drivers/llvm,dslab-epfl/asap,llvm-mirror/llvm,chubbymaggie/asap,llvm-mirror/llvm,llvm-mirror/llvm,llvm-mirror/llvm,apple/swift-llvm,apple/swift-llvm,GPUOpen-Drivers/llvm,GPUOpen-Drivers/llvm,apple/swift-llvm,llvm-mirror/llvm,GPUOpen-Drivers/llvm,dslab-epfl/asap,GPUOpen-Drivers/llvm,dslab-epfl/asap,dslab-epfl/asap,chubbymaggie/asap,llvm-mirror/llvm,llvm-mirror/llvm |
b1167684c00877fac8bb3ebe120f088ff99daa57 | list.h | list.h | #include <stdlib.h>
#ifndef __LIST_H__
#define __LIST_H__
struct ListNode;
struct List;
typedef struct ListNode ListNode;
typedef struct List List;
List* List_Create(void);
void List_Destroy(List* l);
ListNode* ListNode_Create(void *);
void ListNode_Destroy(ListNode* n);
ListNode* List_Search(List* l, void* k, int f(void*, void*));
#endif | #include <stdlib.h>
#ifndef __LIST_H__
#define __LIST_H__
struct ListNode;
struct List;
typedef struct ListNode ListNode;
typedef struct List List;
List* List_Create(void);
void List_Destroy(List* l);
ListNode* ListNode_Create(void *);
void ListNode_Destroy(ListNode* n);
ListNode* List_Search(List* l, void* k, int (f)(void*, void*));
#endif | Fix missing parenthesis around f as parameter | Fix missing parenthesis around f as parameter
| C | mit | MaxLikelihood/CADT |
eb477c92d61c1f2db3d5fd98e842050a4313ba3a | main.c | main.c | #include "kms-endpoint.h"
#include <glib.h>
int main(int argc, char **argv) {
GObject *ep;
GValue val = G_VALUE_INIT;
GError *err = NULL;
KmsConnection *conn = NULL;
g_type_init();
ep = g_object_new(KMS_TYPE_ENDPOINT, "localname", "test_ep", NULL);
if (ep == NULL) {
g_print("Create endpont is: NULL\n");
return 1;
}
g_value_init(&val, G_TYPE_STRING);
g_object_get_property(ep, "localname", &val);
g_print("Created ep with localname: %s\n", g_value_get_string(&val));
conn = kms_endpoint_create_connection(KMS_ENDPOINT(ep),
KMS_CONNECTION_TYPE_RTP, &err);
if (conn == NULL) {
g_print("Connection can not be created: %s\n", err->message);;
g_error_free(err);
goto end;
}
end:
g_object_unref(ep);
return 0;
}
| #include "kms-endpoint.h"
#include <glib.h>
int main(int argc, char **argv) {
GObject *ep;
GValue val = G_VALUE_INIT;
GError *err = NULL;
KmsConnection *conn = NULL;
g_type_init();
ep = g_object_new(KMS_TYPE_ENDPOINT, "localname", "test_ep", NULL);
if (ep == NULL) {
g_print("Create endpont is: NULL\n");
return 1;
}
g_value_init(&val, G_TYPE_STRING);
g_object_get_property(ep, "localname", &val);
g_print("Created ep with localname: %s\n", g_value_get_string(&val));
conn = kms_endpoint_create_connection(KMS_ENDPOINT(ep),
KMS_CONNECTION_TYPE_RTP, &err);
if (conn == NULL) {
g_print("Connection can not be created: %s\n", err->message);;
g_error_free(err);
goto end;
}
g_object_get_property(G_OBJECT(conn), "id", &val);
g_print("Created local connection with id: %s\n",
g_value_get_string(&val));
if (!kms_endpoint_delete_connection(KMS_ENDPOINT(ep), conn, &err)) {
g_printerr("Connection can not be deleted: %s", err->message);
g_error_free(err);
goto end;
}
end:
g_object_unref(ep);
return 0;
}
| Add test for delete connection method | Add test for delete connection method
| C | lgpl-2.1 | mparis/kurento-media-server,lulufei/kurento-media-server,lulufei/kurento-media-server,mparis/kurento-media-server,Kurento/kurento-media-server,todotobe1/kurento-media-server,TribeMedia/kurento-media-server,shelsonjava/kurento-media-server,TribeMedia/kurento-media-server,shelsonjava/kurento-media-server,Kurento/kurento-media-server,todotobe1/kurento-media-server |
4cb0d352ed7208fc9ac71b006dcb1b0ff8d65ca2 | src/xpiks-qt/Models/logsmodel.h | src/xpiks-qt/Models/logsmodel.h | #ifndef LOGSMODEL
#define LOGSMODEL
#include <QString>
#include <QFile>
#include <QDir>
#include <QDebug>
#include <QTextStream>
#include <QStandardPaths>
#include "Helpers/constants.h"
namespace Models {
class LogsModel : public QObject {
Q_OBJECT
public:
Q_INVOKABLE QString getAllLogsText() {
QString result;
#ifdef QT_NO_DEBUG
QDir logFileDir(QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation));
QString logFilePath = logFileDir.filePath(Constants::LOG_FILENAME);
QFile f(logFilePath);
if (f.open(QIODevice::ReadOnly | QIODevice::Text)) {
QTextStream in(&f);
result = in.readAll();
}
#else
result = "Logs are available in Release version";
#endif
return result;
}
};
}
#endif // LOGSMODEL
| #ifndef LOGSMODEL
#define LOGSMODEL
#include <QString>
#include <QFile>
#include <QDir>
#include <QDebug>
#include <QTextStream>
#include <QStandardPaths>
#include "../Helpers/constants.h"
namespace Models {
class LogsModel : public QObject {
Q_OBJECT
public:
Q_INVOKABLE QString getAllLogsText() {
QString result;
#ifdef QT_NO_DEBUG
QDir logFileDir(QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation));
QString logFilePath = logFileDir.filePath(Constants::LOG_FILENAME);
QFile f(logFilePath);
if (f.open(QIODevice::ReadOnly | QIODevice::Text)) {
QTextStream in(&f);
result = in.readAll();
}
#else
result = "Logs are available in Release version";
#endif
return result;
}
};
}
#endif // LOGSMODEL
| Fix for compilation in Windows | Fix for compilation in Windows
| C | mpl-2.0 | Ribtoks/xpiks,Artiom-M/xpiks,Ribtoks/xpiks,Ribtoks/xpiks,Ribtoks/xpiks,Artiom-M/xpiks,Artiom-M/xpiks,Artiom-M/xpiks |
fd440beaf95128b12f2abc279525192bfcc5eca0 | percolation/main.c | percolation/main.c | /* headers */
#include <stdlib.h>
#include <time.h>
#include "lattice.h"
#include "clusters.h"
#include "io_helpers.h"
/* main body function */
int main()
{
int L; /* square lattice size */
double p; /* occupation probability of each lattice site */
int *lattice; /* lattice array */
/* initialize random number generator seed */
srand(time(NULL));
/* allocate lattice */
L = 10;
lattice = allocate_lattice(L, L);
/* populate lattice with given probability */
p = 0.4;
populate_lattice(p, lattice, L, L);
/* print the generated lattice for visualization */
print_lattice(lattice, L, L, 1);
/* label clusters and print result */
label_clusters(lattice, L, L);
print_lattice(lattice, L, L, 1);
/* free memory before leaving */
free(lattice);
return 0;
}
| /* headers */
#include <stdlib.h>
#include <time.h>
#include "lattice.h"
#include "clusters.h"
#include "io_helpers.h"
/* main body function */
int main(int argc, char ** argv)
{
int L; /* square lattice size */
double p; /* occupation probability of each lattice site */
int *lattice; /* lattice array */
/* read input arguments; if none provided fallback to default values */
if (argc == 3) {
L = atoi(argv[1]);
p = atof(argv[2]);
} else {
L = 10;
p = 0.4;
}
/* initialize random number generator seed */
srand(time(NULL));
/* allocate lattice */
lattice = allocate_lattice(L, L);
/* populate lattice with given probability */
populate_lattice(p, lattice, L, L);
/* print the generated lattice for visualization */
print_lattice(lattice, L, L, 1);
/* label clusters and print result */
label_clusters(lattice, L, L);
print_lattice(lattice, L, L, 1);
/* free memory before leaving */
free(lattice);
return 0;
}
| Add passing problem parameters as program arguments | [percolation] Add passing problem parameters as program arguments
| C | mit | cerisola/fiscomp,cerisola/fiscomp,cerisola/fiscomp |
115f2b95d5756319855249fe60aa91e273e3c191 | test/Driver/noexecstack.c | test/Driver/noexecstack.c | // RUN: %clang -### %s -c -o tmp.o -Wa,--noexecstack 2>&1 | grep "mnoexecstack"
| // RUN: %clang -### %s -c -o tmp.o -triple i686-pc-linux-gnu -integrated-as -Wa,--noexecstack 2>&1 | grep "mnoexecstack"
| Fix this test on machines that don't run clang -cc1as when asked to assemble. | Fix this test on machines that don't run clang -cc1as when asked to assemble.
git-svn-id: ffe668792ed300d6c2daa1f6eba2e0aa28d7ec6c@133688 91177308-0d34-0410-b5e6-96231b3b80d8
| C | apache-2.0 | apple/swift-clang,llvm-mirror/clang,apple/swift-clang,llvm-mirror/clang,apple/swift-clang,llvm-mirror/clang,apple/swift-clang,llvm-mirror/clang,llvm-mirror/clang,llvm-mirror/clang,apple/swift-clang,apple/swift-clang,llvm-mirror/clang,llvm-mirror/clang,apple/swift-clang,apple/swift-clang,llvm-mirror/clang,apple/swift-clang,llvm-mirror/clang,apple/swift-clang |
8d7d203342f1573938e99d984ca335f05e1415bb | test/tools/llvm-cov/zeroFunctionFile.c | test/tools/llvm-cov/zeroFunctionFile.c | #include "Inputs/zeroFunctionFile.h"
int foo(int x) {
return NOFUNCTIONS(x);
}
int main() {
return foo(2);
}
// RUN: llvm-profdata merge %S/Inputs/zeroFunctionFile.proftext -o %t.profdata
// RUN: llvm-cov report %S/Inputs/zeroFunctionFile.covmapping -instr-profile %t.profdata 2>&1 | FileCheck --check-prefix=REPORT --strict-whitespace %s
// REPORT: 0 0 - 0 0 - 0 0 - 0 0 -
// REPORT-NO: 0%
// RUN: llvm-cov show %S/Inputs/zeroFunctionFile.covmapping -format html -instr-profile %t.profdata -o %t.dir
// RUN: FileCheck %s -input-file=%t.dir/index.html -check-prefix=HTML
// HTML: <td class='column-entry-green'><pre>- (0/0)
// HTML-NO: 0.00% (0/0)
| #include "Inputs/zeroFunctionFile.h"
int foo(int x) {
return NOFUNCTIONS(x);
}
int main() {
return foo(2);
}
// RUN: llvm-profdata merge %S/Inputs/zeroFunctionFile.proftext -o %t.profdata
// RUN: llvm-cov report %S/Inputs/zeroFunctionFile.covmapping -instr-profile %t.profdata 2>&1 | FileCheck --check-prefix=REPORT --strict-whitespace %s
// REPORT: 0 0 - 0 0 - 0 0 - 0 0 -
// REPORT-NO: 0%
// RUN: llvm-cov show -j 1 %S/Inputs/zeroFunctionFile.covmapping -format html -instr-profile %t.profdata -o %t.dir
// RUN: FileCheck %s -input-file=%t.dir/index.html -check-prefix=HTML
// HTML: <td class='column-entry-green'><pre>- (0/0)
// HTML-NO: 0.00% (0/0)
| Disable threading in a test. NFC. | [llvm-cov] Disable threading in a test. NFC.
PR30735 reports an issue where llvm-cov hangs with a worker thread
waiting on a condition, and the main thread waiting to join() the
workers. While this doesn't appear to be a bug in llvm-cov or the
ThreadPool implementation, it would be helpful to disable the use of
threading in the llvm-cov tests where no test coverage is added.
More context: https://bugs.llvm.org/show_bug.cgi?id=30735
git-svn-id: 0ff597fd157e6f4fc38580e8d64ab130330d2411@307610 91177308-0d34-0410-b5e6-96231b3b80d8
| C | apache-2.0 | llvm-mirror/llvm,llvm-mirror/llvm,apple/swift-llvm,llvm-mirror/llvm,llvm-mirror/llvm,GPUOpen-Drivers/llvm,GPUOpen-Drivers/llvm,GPUOpen-Drivers/llvm,apple/swift-llvm,GPUOpen-Drivers/llvm,llvm-mirror/llvm,llvm-mirror/llvm,apple/swift-llvm,apple/swift-llvm,GPUOpen-Drivers/llvm,apple/swift-llvm,apple/swift-llvm,GPUOpen-Drivers/llvm,apple/swift-llvm,llvm-mirror/llvm,llvm-mirror/llvm,GPUOpen-Drivers/llvm,llvm-mirror/llvm,apple/swift-llvm,GPUOpen-Drivers/llvm |
38f81754a540d7e1212e8b6247aff174aceefced | src/user.c | src/user.c | task blink();
task usercontrol(){
int DY, DT;
bool isReset = false;
startTask(blink);
//Enable Positioning System
startTask(positionsystem);
while(true){
//Driving
DY = threshold(PAIRED_CH2^2 / MAX_POWER, 5);
DT = threshold(PAIRED_CH1^2 / MAX_POWER, 5);
drive(DY, DT);
//Mogo
mogo(threshold(PAIRED_CH3, 15));
//Arm
arm((PAIRED_BTN6U - PAIRED_BTN6D) * MAX_POWER);
//Lift
lift((PAIRED_BTN7U - PAIRED_BTN7D) * MAX_POWER);
//Intake
intake((PAIRED_BTN5U - PAIRED_BTN5D) * MAX_POWER);
//Reset (can be done multiple times, only required once)
if(SensorValue[resetButton]){
resetAll();
isReset = true;
stopTask(blink);
SensorValue[resetLED] = false;
waitUntil(!SensorValue[resetButton]);
}
}
}
task blink(){
while(true){
SensorValue[resetLED] = !SensorValue[resetLED];
wait1Msec(1000);
}
}
| task blink();
task usercontrol(){
int DY, DT;
bool isReset = false;
startTask(blink);
//Enable Positioning System
startTask(positionsystem);
while(true){
//Driving
DY = threshold(PAIRED_CH2^2 / MAX_POWER, 5) + ((PAIRED_BTN8U - PAIRED_BTN8D) * MAX_POWER);
DT = threshold(PAIRED_CH1^2 / MAX_POWER, 5) + ((PAIRED_BTN8R - PAIRED_BTN8L) * MAX_POWER);
drive(DY, DT);
//Mogo
mogo(threshold(PAIRED_CH3, 15));
//Arm
arm((PAIRED_BTN6U - PAIRED_BTN6D) * MAX_POWER);
//Lift
lift((PAIRED_BTN7U - PAIRED_BTN7D) * MAX_POWER);
//Intake
intake((PAIRED_BTN5U - PAIRED_BTN5D) * MAX_POWER);
//Reset (can be done multiple times, only required once)
if(abs(SensorValue[aclZ]) > 50){
startTask(blink);
}
if(SensorValue[resetButton]){
resetAll();
isReset = true;
stopTask(blink);
SensorValue[resetLED] = false;
waitUntil(!SensorValue[resetButton]);
}
}
}
task blink(){
while(true){
SensorValue[resetLED] = !SensorValue[resetLED];
wait1Msec(1000);
}
}
| Add button driving and reset encoder warning when bot picked up | Add button driving and reset encoder warning when bot picked up
| C | mit | 18moorei/code-red-in-the-zone |
a995514733949a433e39edec0966ba2789b57ada | libavutil/pca.h | libavutil/pca.h | /*
* Principal component analysis
* Copyright (c) 2004 Michael Niedermayer <[email protected]>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
/**
* @file pca.h
* Principal component analysis
*/
struct PCA *ff_pca_init(int n);
void ff_pca_free(struct PCA *pca);
void ff_pca_add(struct PCA *pca, double *v);
int ff_pca(struct PCA *pca, double *eigenvector, double *eigenvalue);
| /*
* Principal component analysis
* Copyright (c) 2004 Michael Niedermayer <[email protected]>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
/**
* @file pca.h
* Principal component analysis
*/
#ifndef FFMPEG_PCA_H
#define FFMPEG_PCA_H
struct PCA *ff_pca_init(int n);
void ff_pca_free(struct PCA *pca);
void ff_pca_add(struct PCA *pca, double *v);
int ff_pca(struct PCA *pca, double *eigenvector, double *eigenvalue);
#endif /* FFMPEG_PCA_H */
| Make diego happy before he notices. | Make diego happy before he notices.
git-svn-id: a4d7c1866f8397a4106e0b57fc4fbf792bbdaaaf@14810 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b
| C | lgpl-2.1 | prajnashi/ffmpeg,prajnashi/ffmpeg,prajnashi/ffmpeg,prajnashi/ffmpeg |
89de24b762d3032816d918392725d6ce41d21092 | src/Config.h | src/Config.h | /*
Config (Singleton), extends ofxXMLSettings
Loads app configuration properties from xml file.
*/
#pragma once
#ifndef BBC_CONFIG
#define BBC_CONFIG
#include "XmlSettingsEx.h"
#define CONFIG_GET(_key, _attr, _def) bbc::utils::Config::instance()->getAttribute("config:"_key, _attr, _def)
namespace bbc {
namespace utils {
class Config : public XmlSettingsEx {
public:
static string data_file_path;
static Config* instance(); // pointer to itself
bool load_success;
protected:
Config(); // protected constuctor
};
}
}
#endif | /*
Config (Singleton), extends ofxXMLSettings
Loads app configuration properties from xml file.
*/
#pragma once
#ifndef BBC_CONFIG
#define BBC_CONFIG
#include "XmlSettingsEx.h"
#define CONFIG_GET(_key, _attr, _def) bbc::utils::Config::instance()->getAttribute("config:"_key, _attr, _def)
namespace bbc {
namespace utils {
class Config : public XmlSettingsEx {
public:
static string data_file_path;
static Config* instance(); // pointer to itself
bool load_success;
protected:
Config(); // hidden constuctor
};
}
}
#endif | Tweak to test commiting from submodule | Tweak to test commiting from submodule
| C | mit | radamchin/ofxBBCUtils,radamchin/ofxBBCUtils |
615cdb92ee442cbfac75e3602df857e06ab9aee6 | include/llvm/iOperators.h | include/llvm/iOperators.h | //===-- llvm/iBinary.h - Binary Operator node definitions --------*- C++ -*--=//
//
// This file contains the declarations of all of the Binary Operator classes.
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_IBINARY_H
#define LLVM_IBINARY_H
#include "llvm/InstrTypes.h"
//===----------------------------------------------------------------------===//
// Classes to represent Binary operators
//===----------------------------------------------------------------------===//
//
// All of these classes are subclasses of the BinaryOperator class...
//
class GenericBinaryInst : public BinaryOperator {
public:
GenericBinaryInst(BinaryOps Opcode, Value *S1, Value *S2,
const std::string &Name = "")
: BinaryOperator(Opcode, S1, S2, Name) {
}
};
class SetCondInst : public BinaryOperator {
BinaryOps OpType;
public:
SetCondInst(BinaryOps opType, Value *S1, Value *S2,
const std::string &Name = "");
// getInverseCondition - Return the inverse of the current condition opcode.
// For example seteq -> setne, setgt -> setle, setlt -> setge, etc...
//
BinaryOps getInverseCondition() const;
};
#endif
| //===-- llvm/iBinary.h - Binary Operator node definitions --------*- C++ -*--=//
//
// This file contains the declarations of all of the Binary Operator classes.
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_IBINARY_H
#define LLVM_IBINARY_H
#include "llvm/InstrTypes.h"
//===----------------------------------------------------------------------===//
// Classes to represent Binary operators
//===----------------------------------------------------------------------===//
//
// All of these classes are subclasses of the BinaryOperator class...
//
class GenericBinaryInst : public BinaryOperator {
public:
GenericBinaryInst(BinaryOps Opcode, Value *S1, Value *S2,
const std::string &Name = "")
: BinaryOperator(Opcode, S1, S2, Name) {
}
};
class SetCondInst : public BinaryOperator {
BinaryOps OpType;
public:
SetCondInst(BinaryOps opType, Value *S1, Value *S2,
const std::string &Name = "");
// getInverseCondition - Return the inverse of the current condition opcode.
// For example seteq -> setne, setgt -> setle, setlt -> setge, etc...
//
BinaryOps getInverseCondition() const;
// Methods for support type inquiry through isa, cast, and dyn_cast:
static inline bool classof(const SetCondInst *) { return true; }
static inline bool classof(const Instruction *I) {
return I->getOpcode() == SetEQ || I->getOpcode() == SetNE ||
I->getOpcode() == SetLE || I->getOpcode() == SetGE ||
I->getOpcode() == SetLT || I->getOpcode() == SetGT;
}
static inline bool classof(const Value *V) {
return isa<Instruction>(V) && classof(cast<Instruction>(V));
}
};
#endif
| Implement classof for SetCondInst so that instcombine doesn't break on dyn_cast<SetCondInst> | Implement classof for SetCondInst so that instcombine doesn't break on dyn_cast<SetCondInst>
git-svn-id: 0ff597fd157e6f4fc38580e8d64ab130330d2411@3493 91177308-0d34-0410-b5e6-96231b3b80d8
| C | apache-2.0 | llvm-mirror/llvm,llvm-mirror/llvm,apple/swift-llvm,chubbymaggie/asap,apple/swift-llvm,llvm-mirror/llvm,GPUOpen-Drivers/llvm,chubbymaggie/asap,dslab-epfl/asap,dslab-epfl/asap,apple/swift-llvm,GPUOpen-Drivers/llvm,dslab-epfl/asap,GPUOpen-Drivers/llvm,apple/swift-llvm,GPUOpen-Drivers/llvm,apple/swift-llvm,dslab-epfl/asap,apple/swift-llvm,dslab-epfl/asap,dslab-epfl/asap,GPUOpen-Drivers/llvm,llvm-mirror/llvm,chubbymaggie/asap,apple/swift-llvm,llvm-mirror/llvm,dslab-epfl/asap,apple/swift-llvm,chubbymaggie/asap,GPUOpen-Drivers/llvm,chubbymaggie/asap,llvm-mirror/llvm,GPUOpen-Drivers/llvm,chubbymaggie/asap,llvm-mirror/llvm,llvm-mirror/llvm,GPUOpen-Drivers/llvm,llvm-mirror/llvm |
061bf34805bbe88b25f9084b9f99a7096689c5d8 | library/strings_format.h | library/strings_format.h | #pragma once
#define TINYFORMAT_USE_VARIADIC_TEMPLATES
#ifdef __GNUC__
// Tinyformat has a number of non-annotated switch fallthrough cases
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wimplicit-fallthrough"
#endif
#include "dependencies/tinyformat/tinyformat.h"
#ifdef __GNUC__
#pragma GCC diagnostic pop
#endif
#include "library/strings.h"
namespace OpenApoc
{
template <typename... Args> static UString format(const UString &fmt, Args &&... args)
{
return tfm::format(fmt.cStr(), std::forward<Args>(args)...);
}
UString tr(const UString &str, const UString domain = "ufo_string");
} // namespace OpenApoc
| #pragma once
#include "fmt/printf.h"
#include "library/strings.h"
namespace OpenApoc
{
template <typename... Args> static UString format(const UString &fmt, Args &&... args)
{
return fmt::sprintf(fmt.str(), std::forward<Args>(args)...);
}
UString tr(const UString &str, const UString domain = "ufo_string");
} // namespace OpenApoc
template <> struct fmt::formatter<OpenApoc::UString> : formatter<std::string>
{
template <typename FormatContext> auto format(const OpenApoc::UString &s, FormatContext &ctx)
{
return formatter<std::string>::format(s.str(), ctx);
}
};
| Use fmtlib's sprintf instead of tinyformat | Use fmtlib's sprintf instead of tinyformat
TODO: Move to the indexed formatting strings for fmtlib
| C | mit | Istrebitel/OpenApoc,pmprog/OpenApoc,pmprog/OpenApoc,steveschnepp/OpenApoc,Istrebitel/OpenApoc,steveschnepp/OpenApoc |
c7d9355a433bbd0f82dfa466bf220101e456789a | base/type_defs.h | base/type_defs.h | #pragma once
#include <string>
#include <cstdlib>
// Integer types
typedef char int8_t;
typedef unsigned char uint8_t;
typedef short int16_t;
typedef unsigned short uint16_t;
typedef long int32_t;
typedef unsigned long uint32_t;
typedef long long int64_t;
typedef unsigned long long uint64_t;
#ifndef _swap_int
template <typename T>
void _swap_int(T& a, T& b) { T t(a); a = b; b = t; }
#endif // !_swap_int | #pragma once
#include <string>
#include <cstdlib>
// Integer types
#ifdef int8_t
typedef char int8_t;
#endif // !int8_t
#ifdef uint8_t
typedef unsigned char uint8_t;
#endif // !uint8_t
#ifdef int16_t
typedef short int16_t;
#endif // !int16_t
#ifdef uint16_t
typedef unsigned short uint16_t;
#endif // !uint16_t
#ifdef int32_t
typedef long int32_t;
#endif // !int32_t
#ifdef uint32_t
typedef unsigned long uint32_t;
#endif // !uint32_t
#ifdef int64_t
typedef long long int64_t;
#endif // !int64_t
#ifdef uint64_t
typedef unsigned long long uint64_t;
#endif // !uint64_t
#ifndef _swap_int
template <typename T>
void _swap_int(T& a, T& b) { T t(a); a = b; b = t; }
#endif // !_swap_int | Fix basic type redefinition errors | Fix basic type redefinition errors
| C | mit | LartSimZ/gameAmbiance |
4cabeb8a7181b841457efa594287b66bf81956e4 | src/skbuff.c | src/skbuff.c | #include "syshead.h"
#include "skbuff.h"
struct sk_buff *alloc_skb(unsigned int size)
{
struct sk_buff *skb = malloc(sizeof(struct sk_buff));
skb->data = malloc(size);
skb->head = skb->data;
skb->tail = skb->data;
skb->end = skb->tail + size;
return skb;
}
void *skb_reserve(struct sk_buff *skb, unsigned int len)
{
skb->data += len;
skb->tail += len;
return skb->data;
}
uint8_t *skb_push(struct sk_buff *skb, unsigned int len)
{
skb->data -= len;
skb->len += len;
return skb->data;
}
void skb_dst_set(struct sk_buff *skb, struct dst_entry *dst)
{
skb->dst = dst;
}
| #include "syshead.h"
#include "skbuff.h"
struct sk_buff *alloc_skb(unsigned int size)
{
struct sk_buff *skb = malloc(sizeof(struct sk_buff));
memset(skb, 0, sizeof(struct sk_buff));
skb->data = malloc(size);
memset(skb->data, 0, size);
skb->head = skb->data;
skb->tail = skb->data;
skb->end = skb->tail + size;
return skb;
}
void *skb_reserve(struct sk_buff *skb, unsigned int len)
{
skb->data += len;
skb->tail += len;
return skb->data;
}
uint8_t *skb_push(struct sk_buff *skb, unsigned int len)
{
skb->data -= len;
skb->len += len;
return skb->data;
}
void skb_dst_set(struct sk_buff *skb, struct dst_entry *dst)
{
skb->dst = dst;
}
| Fix Valgrind complaint about unitialized heap memory | Fix Valgrind complaint about unitialized heap memory
| C | mit | saminiir/level-ip,saminiir/level-ip |
39ec68310c69c7f86f4a2fa638782094ef17ac6b | packages/Python/lldbsuite/test/functionalities/breakpoint/debugbreak/main.c | packages/Python/lldbsuite/test/functionalities/breakpoint/debugbreak/main.c | #ifdef _MSC_VER
#include <intrin.h>
#define BREAKPOINT_INTRINSIC() __debugbreak()
#else
#define BREAKPOINT_INTRINSIC() __asm__ __volatile__ ("int3")
#endif
int
bar(int const *foo)
{
int count = 0;
for (int i = 0; i < 10; ++i)
{
count += 1;
BREAKPOINT_INTRINSIC();
count += 1;
}
return *foo;
}
int
main(int argc, char **argv)
{
int foo = 42;
bar(&foo);
return 0;
}
| #ifdef _MSC_VER
#include <intrin.h>
#define BREAKPOINT_INTRINSIC() __debugbreak()
#else
#define BREAKPOINT_INTRINSIC() __asm__ __volatile__ ("int3")
#endif
int
bar(int const *foo)
{
int count = 0, i = 0;
for (; i < 10; ++i)
{
count += 1;
BREAKPOINT_INTRINSIC();
count += 1;
}
return *foo;
}
int
main(int argc, char **argv)
{
int foo = 42;
bar(&foo);
return 0;
}
| Fix TestDebugBreak.py failure with gcc, for loop declarations are not allowed by default with gcc | Fix TestDebugBreak.py failure with gcc, for loop declarations are not allowed by default with gcc
- fix buildbot breakage after r257186
- move declaration outside of for loop
git-svn-id: 4c4cc70b1ef44ba2b7963015e681894188cea27e@257228 91177308-0d34-0410-b5e6-96231b3b80d8
| C | apache-2.0 | apple/swift-lldb,llvm-mirror/lldb,llvm-mirror/lldb,apple/swift-lldb,apple/swift-lldb,llvm-mirror/lldb,llvm-mirror/lldb,llvm-mirror/lldb,apple/swift-lldb,apple/swift-lldb,apple/swift-lldb |
79f3cfe1af88a4dd9b2343f14d50289106d5d973 | firmware/i2c_lcd.c | firmware/i2c_lcd.c | #include <avr/io.h>
#include <util/delay.h>
#include "slcd.h"
int main()
{
init_lcd();
uint8_t backlit = 1;
while (1)
{
lcd_clrscr();
lcd_goto(LINE1);
lcd_puts("Line 1", backlit);
lcd_goto(LINE2);
lcd_puts("Line 2", backlit);
lcd_goto(LINE3);
lcd_puts("Line 3", backlit);
lcd_goto(LINE4);
lcd_puts("Line 4", backlit);
_delay_ms(500);
// Blink the backlight
for (uint8_t i=0; i<6; i++)
{
send_byte(0, 0x80 + LINE4 + 6, i%2);
_delay_ms(50);
}
_delay_ms(500);
}
return 0;
}
| #include <avr/io.h>
#include <util/delay.h>
#include "slcd.h"
int main()
{
init_lcd();
uint8_t backlit = 1;
while (1)
{
lcd_clrscr();
lcd_goto(0, 0);
lcd_puts("Line 1", backlit);
lcd_goto(1, 0);
lcd_puts("Line 2", backlit);
lcd_goto(2, 0);
lcd_puts("Line 3", backlit);
lcd_goto(3, 0);
lcd_puts("Line 4", backlit);
_delay_ms(500);
// Blink the backlight
for (uint8_t i=0; i<6; i++)
{
send_byte(0, 0x80 + LCD_LINE3 + 6, i%2);
_delay_ms(50);
}
_delay_ms(500);
// Raster the cursor to check the goto function
lcd_clrscr();
for (uint8_t i=0; i<LCD_LINES; i++)
for (uint8_t j=0; j<LCD_WIDTH; j++)
{
lcd_goto(i, j);
_delay_ms(100);
}
}
return 0;
}
| Adjust to changes in slcd library | Adjust to changes in slcd library
| C | mit | andrewadare/avr-breadboarding,andrewadare/avr-breadboarding |
a5a60654efc3f97ba1cf6cbf7043c28ed9860b02 | cmd/lefty/exec.h | cmd/lefty/exec.h | /* $Id$ $Revision$ */
/* vim:set shiftwidth=4 ts=8: */
/**********************************************************
* This software is part of the graphviz package *
* http://www.graphviz.org/ *
* *
* Copyright (c) 1994-2004 AT&T Corp. *
* and is licensed under the *
* Common Public License, Version 1.0 *
* by AT&T Corp. *
* *
* Information and Software Systems Research *
* AT&T Research, Florham Park NJ *
**********************************************************/
#ifdef __cplusplus
extern "C" {
#endif
/* Lefteris Koutsofios - AT&T Bell Laboratories */
#ifndef _EXEC_H
#define _EXEC_H
typedef struct Tonm_t lvar_t;
extern Tobj root, null;
extern Tobj rtno;
extern int Erun;
extern int Eerrlevel, Estackdepth, Eshowbody, Eshowcalls, Eoktorun;
void Einit(void);
void Eterm(void);
Tobj Eunit(Tobj);
Tobj Efunction(Tobj, char *);
#endif /* _EXEC_H */
#ifdef __cplusplus
}
#endif
| /* $Id$ $Revision$ */
/* vim:set shiftwidth=4 ts=8: */
/**********************************************************
* This software is part of the graphviz package *
* http://www.graphviz.org/ *
* *
* Copyright (c) 1994-2004 AT&T Corp. *
* and is licensed under the *
* Common Public License, Version 1.0 *
* by AT&T Corp. *
* *
* Information and Software Systems Research *
* AT&T Research, Florham Park NJ *
**********************************************************/
#ifdef __cplusplus
extern "C" {
#endif
/* Lefteris Koutsofios - AT&T Labs Research */
#ifndef _EXEC_H
#define _EXEC_H
typedef struct Tonm_t lvar_t;
extern Tobj root, null;
extern Tobj rtno;
extern int Erun;
extern int Eerrlevel, Estackdepth, Eshowbody, Eshowcalls, Eoktorun;
void Einit (void);
void Eterm (void);
Tobj Eunit (Tobj);
Tobj Efunction (Tobj, char *);
#endif /* _EXEC_H */
#ifdef __cplusplus
}
#endif
| Update with new lefty, fixing many bugs and supporting new features | Update with new lefty, fixing many bugs and supporting new features
| C | epl-1.0 | MjAbuz/graphviz,MjAbuz/graphviz,jho1965us/graphviz,BMJHayward/graphviz,pixelglow/graphviz,kbrock/graphviz,jho1965us/graphviz,kbrock/graphviz,ellson/graphviz,kbrock/graphviz,BMJHayward/graphviz,tkelman/graphviz,jho1965us/graphviz,MjAbuz/graphviz,ellson/graphviz,ellson/graphviz,pixelglow/graphviz,BMJHayward/graphviz,pixelglow/graphviz,BMJHayward/graphviz,MjAbuz/graphviz,tkelman/graphviz,tkelman/graphviz,pixelglow/graphviz,ellson/graphviz,ellson/graphviz,MjAbuz/graphviz,pixelglow/graphviz,jho1965us/graphviz,pixelglow/graphviz,kbrock/graphviz,ellson/graphviz,kbrock/graphviz,pixelglow/graphviz,tkelman/graphviz,BMJHayward/graphviz,jho1965us/graphviz,BMJHayward/graphviz,tkelman/graphviz,kbrock/graphviz,BMJHayward/graphviz,pixelglow/graphviz,tkelman/graphviz,ellson/graphviz,ellson/graphviz,ellson/graphviz,jho1965us/graphviz,pixelglow/graphviz,kbrock/graphviz,tkelman/graphviz,tkelman/graphviz,MjAbuz/graphviz,MjAbuz/graphviz,tkelman/graphviz,MjAbuz/graphviz,kbrock/graphviz,jho1965us/graphviz,BMJHayward/graphviz,jho1965us/graphviz,kbrock/graphviz,ellson/graphviz,jho1965us/graphviz,MjAbuz/graphviz,tkelman/graphviz,BMJHayward/graphviz,tkelman/graphviz,BMJHayward/graphviz,kbrock/graphviz,jho1965us/graphviz,MjAbuz/graphviz,pixelglow/graphviz,jho1965us/graphviz,pixelglow/graphviz,kbrock/graphviz,MjAbuz/graphviz,ellson/graphviz,BMJHayward/graphviz |
3f37918a0580654ff642a70276f5b94651d224c5 | DeepLinkSDK/DeepLinkSDK.h | DeepLinkSDK/DeepLinkSDK.h | #import "DPLTargetViewControllerProtocol.h"
#import "DPLDeepLinkRouter.h"
#import "DPLRouteHandler.h"
#import "DPLDeepLink.h"
#import "DPLErrors.h"
| #import "DPLTargetViewControllerProtocol.h"
#import "DPLDeepLinkRouter.h"
#import "DPLRouteHandler.h"
#import "DPLDeepLink.h"
#import "DPLMutableDeepLink.h"
#import "DPLErrors.h"
| Add mutable deep link to sdk header. | Add mutable deep link to sdk header.
| C | mit | button/DeepLinkKit,button/DeepLinkKit,button/DeepLinkKit,usebutton/DeepLinkKit,button/DeepLinkKit,usebutton/DeepLinkKit,usebutton/DeepLinkKit |
aab5eceb9b33a5109792ba52bc9f1ddf39059364 | src/debug.h | src/debug.h | /*
Copyright libCellML Contributors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
#pragma once
#include <iostream>
#include <sstream>
namespace libcellml {
struct dbg
{
dbg() = default;
~dbg()
{
std::cout << mSS.str() << std::endl;
}
public:
dbg &operator<<(const void *p)
{
const void *address = static_cast<const void *>(p);
std::ostringstream ss;
ss << address;
mSS << ss.str();
return *this;
}
// accepts just about anything
template<class T>
dbg &operator<<(const T &x)
{
mSS << x;
return *this;
}
private:
std::ostringstream mSS;
};
} // namespace libcellml
| /*
Copyright libCellML Contributors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
#pragma once
#include <iostream>
#include <sstream>
namespace libcellml {
struct Debug
{
Debug() = default;
~Debug()
{
std::cout << mSS.str() << std::endl;
}
Debug &operator<<(const void *p)
{
const void *address = static_cast<const void *>(p);
std::ostringstream ss;
ss << address;
mSS << ss.str();
return *this;
}
// accepts just about anything
template<class T>
Debug &operator<<(const T &x)
{
mSS << x;
return *this;
}
private:
std::ostringstream mSS;
};
} // namespace libcellml
| Rename dbg struct to Debug. | Rename dbg struct to Debug.
| C | apache-2.0 | MichaelClerx/libcellml,cellml/libcellml,cellml/libcellml,hsorby/libcellml,cellml/libcellml,nickerso/libcellml,MichaelClerx/libcellml,nickerso/libcellml,hsorby/libcellml,nickerso/libcellml,cellml/libcellml,nickerso/libcellml,MichaelClerx/libcellml,hsorby/libcellml,hsorby/libcellml |
62818dc7b1772e8471615dc22fbf5c5be3b896d0 | AddToItself.c | AddToItself.c | /* last written on 11/09/2017 16:34:14
owner ise2017001 rajaneesh
@devrezo on twitter
@devrezo on github
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
struct node {
int data;
struct node *next;
};
struct node *createNode (int value) {
struct node *newNode = (struct node *) malloc (sizeof (struct node));
newNode -> data = value;
newNode -> next = NULL;
return newNode;
}
void insertNode (struct node **head_ref, struct node **tail_ref, int value) {
struct node *newNode = createNode (value);
if (*head_ref == NULL) {
*head_ref = newNode;
*tail_ref = newNode;
}
else {
(*tail_ref) -> next = newNode;
*tail_ref = newNode;
}
}
void printList (struct node *head) {
while (head != NULL) {
printf ("%d -> ", head->data);
head = head->next;
}
printf ("NULL\n");
}
void destroyList (struct node *head) {
struct node *nextNode = head;
while (head != NULL) {
nextNode = head -> next;
free (head);
head = nextNode;
}
printf("Killed off all her feelings\n" );
}
void addToItself (struct node **head_ref) {
struct node *headNew = NULL;
struct node *tailNew = NULL;
struct node *prevNode = NULL;
struct node *currentNode = NULL;
currentNode = (*head_ref);
if (currentNode == NULL) {
return;
}
while (currentNode != NULL) {
insertNode (&headNew, &tailNew, currentNode->data);
prevNode = currentNode;
currentNode = currentNode->next;
}
prevNode->next = headNew;
return;
}
int main (int argc, char *argv[]) {
int value;
struct node *head = NULL, *tail = NULL;
char buffer[2048];
char *p = NULL;
fgets (buffer, 2048, stdin);
p = strtok (buffer, "NULL >|\n");
while (p != NULL) {
sscanf (p, "%d", &value);
insertNode (&head, &tail, value);
p = strtok (NULL, "> | NULL \n");
}
printList (head);
addToItself (&head);
printList (head);
destroyList (head);
head = NULL;
tail = NULL;
return 0;
}
| Add a linked list to itself | Added: Add a linked list to itself
have two new pointers headNew and tailNew
create a linked list as we traverse through the list using the insertNode method. | C | mit | devrezo/iaap |
|
ec00e8cfc23cb7d04a9b13730607d6c094446f36 | test/tstsoap1.c | test/tstsoap1.c | /*
* Copyright (C) 1995-2005, Index Data ApS
* See the file LICENSE for details.
*
* $Id: tstsoap1.c,v 1.1 2005-05-06 11:11:37 adam Exp $
*/
#include <stdlib.h>
#if HAVE_XML2
#include <libxml/parser.h>
#endif
int main(int argc, char **argv)
{
#if HAVE_XML2
LIBXML_TEST_VERSION;
if (argc <= 1)
{
xmlChar *buf_out;
int len_out;
xmlDocPtr doc = xmlNewDoc("1.0");
#if 0
const char *val = "jordbr"; /* makes xmlDocDumpMemory hang .. */
#else
const char *val = "jordbaer"; /* OK */
#endif
xmlNodePtr top = xmlNewNode(0, "top");
xmlNewTextChild(top, 0, "sub", val);
xmlDocSetRootElement(doc, top);
xmlDocDumpMemory(doc, &buf_out, &len_out);
printf("%*s", len_out, buf_out);
}
#endif
return 0;
}
| /*
* Copyright (C) 1995-2005, Index Data ApS
* See the file LICENSE for details.
*
* $Id: tstsoap1.c,v 1.2 2005-05-08 07:33:12 adam Exp $
*/
#include <stdlib.h>
#if HAVE_XML2
#include <libxml/parser.h>
#endif
int main(int argc, char **argv)
{
#if HAVE_XML2
LIBXML_TEST_VERSION;
if (argc <= 1)
{
xmlChar *buf_out;
int len_out;
xmlDocPtr doc = xmlNewDoc("1.0");
#if 0
const char *val = "jordbr"; /* makes xmlDocDumpMemory hang .. */
#else
const char *val = "jordbaer"; /* OK */
#endif
xmlNodePtr top = xmlNewNode(0, "top");
xmlNewTextChild(top, 0, "sub", val);
xmlDocSetRootElement(doc, top);
xmlDocDumpMemory(doc, &buf_out, &len_out);
#if 0
printf("%*s", len_out, buf_out);
#endif
}
#endif
return 0;
}
| Comment out debug printf stmt | Comment out debug printf stmt
| C | bsd-3-clause | nla/yaz,dcrossleyau/yaz,nla/yaz,dcrossleyau/yaz,dcrossleyau/yaz,nla/yaz,nla/yaz |
1c067fe6149a5b428c3f32cd7a3926992922c40c | public/platform/modules/push_messaging/WebPushSubscriptionOptions.h | public/platform/modules/push_messaging/WebPushSubscriptionOptions.h | // Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef WebPushSubscriptionOptions_h
#define WebPushSubscriptionOptions_h
namespace blink {
struct WebPushSubscriptionOptions {
WebPushSubscriptionOptions()
: userVisible(false)
{
}
// Indicates that the subscription will only be used for push messages
// that result in UI visible to the user.
bool userVisible;
};
} // namespace blink
#endif // WebPushSubscriptionOptions_h
| Introduce a PushSubscriptionOptions struct in the Blink API. | Introduce a PushSubscriptionOptions struct in the Blink API.
This object will contain the values available in the new Web exposed
PushSubscriptionOptions dictionary, which will be introduced in the
third patch of this series.
This CL is part of a series of four:
[1] This patch.
[2] https://codereview.chromium.org/1043723003/
[3] https://codereview.chromium.org/1044663002/
[4] https://codereview.chromium.org/1044673002/
BUG=471534
Review URL: https://codereview.chromium.org/1047533002
git-svn-id: bf5cd6ccde378db821296732a091cfbcf5285fbd@192834 bbb929c8-8fbe-4397-9dbb-9b2b20218538
| C | bsd-3-clause | kurli/blink-crosswalk,Pluto-tv/blink-crosswalk,kurli/blink-crosswalk,PeterWangIntel/blink-crosswalk,kurli/blink-crosswalk,PeterWangIntel/blink-crosswalk,kurli/blink-crosswalk,PeterWangIntel/blink-crosswalk,Pluto-tv/blink-crosswalk,Pluto-tv/blink-crosswalk,smishenk/blink-crosswalk,Bysmyyr/blink-crosswalk,smishenk/blink-crosswalk,Pluto-tv/blink-crosswalk,XiaosongWei/blink-crosswalk,XiaosongWei/blink-crosswalk,smishenk/blink-crosswalk,PeterWangIntel/blink-crosswalk,XiaosongWei/blink-crosswalk,PeterWangIntel/blink-crosswalk,smishenk/blink-crosswalk,kurli/blink-crosswalk,Bysmyyr/blink-crosswalk,Bysmyyr/blink-crosswalk,Pluto-tv/blink-crosswalk,PeterWangIntel/blink-crosswalk,smishenk/blink-crosswalk,kurli/blink-crosswalk,PeterWangIntel/blink-crosswalk,Bysmyyr/blink-crosswalk,kurli/blink-crosswalk,Bysmyyr/blink-crosswalk,XiaosongWei/blink-crosswalk,smishenk/blink-crosswalk,Bysmyyr/blink-crosswalk,kurli/blink-crosswalk,XiaosongWei/blink-crosswalk,Pluto-tv/blink-crosswalk,Pluto-tv/blink-crosswalk,PeterWangIntel/blink-crosswalk,smishenk/blink-crosswalk,kurli/blink-crosswalk,Bysmyyr/blink-crosswalk,PeterWangIntel/blink-crosswalk,kurli/blink-crosswalk,Bysmyyr/blink-crosswalk,smishenk/blink-crosswalk,XiaosongWei/blink-crosswalk,Pluto-tv/blink-crosswalk,smishenk/blink-crosswalk,Pluto-tv/blink-crosswalk,XiaosongWei/blink-crosswalk,XiaosongWei/blink-crosswalk,Pluto-tv/blink-crosswalk,Bysmyyr/blink-crosswalk,PeterWangIntel/blink-crosswalk,XiaosongWei/blink-crosswalk,XiaosongWei/blink-crosswalk,Bysmyyr/blink-crosswalk,smishenk/blink-crosswalk |
|
a362d5e8273bdafe5be847b7e4020104cf7960c6 | src/mathml.h | src/mathml.h | /*
Copyright libCellML Contributors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
#pragma once
#include <string>
namespace libcellml {
/**
* @brief Compare math to determine if it is equal.
*
* Compare the given math strings to determin if they are equal or not.
* The current test is a simplistic comparison of string equality.
*
* @param math1 The first parameter to compare against parameter two.
* @param math2 The second parameter to compare against parameter one.
* @return Return @c true if the @p math1 is equal to @p math2, @c false otherwise.
*/
bool compareMath(const std::string &math1, const std::string &math2);
} // namespace libcellml
| /*
Copyright libCellML Contributors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
#pragma once
#include <string>
namespace libcellml {
/**
* @brief Compare math to determine if it is equal.
*
* Compare the given math strings to determine if they are equal or not.
* The current test is a simplistic comparison of string equality.
*
* @param math1 The first parameter to compare against parameter two.
* @param math2 The second parameter to compare against parameter one.
* @return Return @c true if the @p math1 is equal to @p math2, @c false otherwise.
*/
bool compareMath(const std::string &math1, const std::string &math2);
} // namespace libcellml
| Fix typo in compareMath doxygen documentation. | Fix typo in compareMath doxygen documentation.
| C | apache-2.0 | hsorby/libcellml,cellml/libcellml,nickerso/libcellml,nickerso/libcellml,cellml/libcellml,hsorby/libcellml,cellml/libcellml,nickerso/libcellml,cellml/libcellml,hsorby/libcellml,nickerso/libcellml,hsorby/libcellml |
4bc83be34066a7a42c6297db983e1d9066e14d3e | chrome/renderer/webview_color_overlay.h | chrome/renderer/webview_color_overlay.h | // Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_RENDERER_WEBVIEW_COLOR_OVERLAY_H_
#define CHROME_RENDERER_WEBVIEW_COLOR_OVERLAY_H_
#pragma once
#include "base/basictypes.h"
#include "base/compiler_specific.h"
#include "third_party/skia/include/core/SkColor.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebPageOverlay.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebRect.h"
namespace content {
class RenderView;
}
// This class draws the given color on a PageOverlay of a WebView.
class WebViewColorOverlay : public WebKit::WebPageOverlay {
public:
WebViewColorOverlay(content::RenderView* render_view, SkColor color);
virtual ~WebViewColorOverlay();
private:
// WebKit::WebPageOverlay implementation:
virtual void paintPageOverlay(WebKit::WebCanvas* canvas);
content::RenderView* render_view_;
SkColor color_;
DISALLOW_COPY_AND_ASSIGN(WebViewColorOverlay);
};
#endif // CHROME_RENDERER_WEBVIEW_COLOR_OVERLAY_H_
| // Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_RENDERER_WEBVIEW_COLOR_OVERLAY_H_
#define CHROME_RENDERER_WEBVIEW_COLOR_OVERLAY_H_
#pragma once
#include "base/basictypes.h"
#include "base/compiler_specific.h"
#include "third_party/skia/include/core/SkColor.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebPageOverlay.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebRect.h"
namespace content {
class RenderView;
}
// This class draws the given color on a PageOverlay of a WebView.
class WebViewColorOverlay : public WebKit::WebPageOverlay {
public:
WebViewColorOverlay(content::RenderView* render_view, SkColor color);
virtual ~WebViewColorOverlay();
private:
// WebKit::WebPageOverlay implementation:
virtual void paintPageOverlay(WebKit::WebCanvas* canvas);
content::RenderView* render_view_;
SkColor color_;
DISALLOW_COPY_AND_ASSIGN(WebViewColorOverlay);
};
#endif // CHROME_RENDERER_WEBVIEW_COLOR_OVERLAY_H_
| Fix build break from the future. | Fix build break from the future.
TBR=pfeldman
Review URL: http://codereview.chromium.org/8801036
git-svn-id: de016e52bd170d2d4f2344f9bf92d50478b649e0@113098 0039d316-1c4b-4281-b951-d872f2087c98
| C | bsd-3-clause | ropik/chromium,gavinp/chromium,adobe/chromium,adobe/chromium,yitian134/chromium,yitian134/chromium,gavinp/chromium,adobe/chromium,yitian134/chromium,adobe/chromium,gavinp/chromium,ropik/chromium,ropik/chromium,yitian134/chromium,adobe/chromium,yitian134/chromium,gavinp/chromium,gavinp/chromium,gavinp/chromium,yitian134/chromium,adobe/chromium,adobe/chromium,ropik/chromium,adobe/chromium,adobe/chromium,ropik/chromium,gavinp/chromium,yitian134/chromium,ropik/chromium,adobe/chromium,yitian134/chromium,ropik/chromium,gavinp/chromium,yitian134/chromium,gavinp/chromium,gavinp/chromium,ropik/chromium,adobe/chromium,yitian134/chromium,ropik/chromium |
7497b92c2f3de3f6ae78310d8d1fdc6fc78d42db | test/CFrontend/2008-04-08-NoExceptions.c | test/CFrontend/2008-04-08-NoExceptions.c | // RUN: %llvmgcc -S -o - %s | grep nounwind | count 2
// RUN: %llvmgcc -S -o - %s | not grep {declare.*nounwind}
void f(void);
void g(void) {
f();
}
| Check that bodies and calls but not declarations are marked nounwind when compiling without -fexceptions. | Check that bodies and calls but not declarations
are marked nounwind when compiling without
-fexceptions.
git-svn-id: 0ff597fd157e6f4fc38580e8d64ab130330d2411@49393 91177308-0d34-0410-b5e6-96231b3b80d8
| C | apache-2.0 | apple/swift-llvm,dslab-epfl/asap,llvm-mirror/llvm,dslab-epfl/asap,chubbymaggie/asap,dslab-epfl/asap,llvm-mirror/llvm,llvm-mirror/llvm,llvm-mirror/llvm,chubbymaggie/asap,dslab-epfl/asap,GPUOpen-Drivers/llvm,apple/swift-llvm,GPUOpen-Drivers/llvm,apple/swift-llvm,dslab-epfl/asap,GPUOpen-Drivers/llvm,apple/swift-llvm,GPUOpen-Drivers/llvm,GPUOpen-Drivers/llvm,apple/swift-llvm,chubbymaggie/asap,apple/swift-llvm,llvm-mirror/llvm,llvm-mirror/llvm,chubbymaggie/asap,apple/swift-llvm,chubbymaggie/asap,llvm-mirror/llvm,apple/swift-llvm,llvm-mirror/llvm,llvm-mirror/llvm,dslab-epfl/asap,GPUOpen-Drivers/llvm,chubbymaggie/asap,GPUOpen-Drivers/llvm,dslab-epfl/asap,GPUOpen-Drivers/llvm |
|
1d9582cf96b666f3d45d504f2697eb82c5fc9f25 | test/FrontendC/2010-12-01-CommonGlobal.c | test/FrontendC/2010-12-01-CommonGlobal.c | // RUN: %llvmgcc -S %s -o - | llvm-as -o /dev/null
// Don't crash on a common-linkage constant global.
extern const int kABSourceTypeProperty;
int foo(void) {
return kABSourceTypeProperty;
}
const int kABSourceTypeProperty;
| Test case for r120740. Radar 8712503. | Test case for r120740. Radar 8712503.
git-svn-id: 0ff597fd157e6f4fc38580e8d64ab130330d2411@120741 91177308-0d34-0410-b5e6-96231b3b80d8
| C | apache-2.0 | GPUOpen-Drivers/llvm,apple/swift-llvm,apple/swift-llvm,llvm-mirror/llvm,llvm-mirror/llvm,llvm-mirror/llvm,llvm-mirror/llvm,GPUOpen-Drivers/llvm,apple/swift-llvm,dslab-epfl/asap,chubbymaggie/asap,chubbymaggie/asap,dslab-epfl/asap,apple/swift-llvm,GPUOpen-Drivers/llvm,apple/swift-llvm,llvm-mirror/llvm,dslab-epfl/asap,dslab-epfl/asap,GPUOpen-Drivers/llvm,GPUOpen-Drivers/llvm,dslab-epfl/asap,dslab-epfl/asap,llvm-mirror/llvm,chubbymaggie/asap,apple/swift-llvm,llvm-mirror/llvm,dslab-epfl/asap,chubbymaggie/asap,GPUOpen-Drivers/llvm,chubbymaggie/asap,chubbymaggie/asap,GPUOpen-Drivers/llvm,apple/swift-llvm,GPUOpen-Drivers/llvm,llvm-mirror/llvm,llvm-mirror/llvm,apple/swift-llvm |
|
17530c3d7eceb106a74066446404117158e8aa93 | iobuf/ibuf_readall.c | iobuf/ibuf_readall.c | #include <iobuf/iobuf.h>
#include <str/str.h>
/** Read the remainder of the \c ibuf into the \c str. */
int ibuf_readall(ibuf* in, str* out)
{
for (;;) {
if (!str_catb(out,
in->io.buffer+in->io.bufstart,
in->io.buflen-in->io.bufstart))
return 0;
in->io.bufstart = in->io.buflen;
if (!ibuf_refill(in))
return ibuf_eof(in);
}
}
| #include <iobuf/iobuf.h>
#include <str/str.h>
/** Read the remainder of the \c ibuf into the \c str. */
int ibuf_readall(ibuf* in, str* out)
{
if (ibuf_eof(in)) return 1;
if (ibuf_error(in)) return 0;
for (;;) {
if (!str_catb(out,
in->io.buffer+in->io.bufstart,
in->io.buflen-in->io.bufstart))
return 0;
in->io.bufstart = in->io.buflen;
if (!ibuf_refill(in))
return ibuf_eof(in);
}
}
| Make sure to do sanity checking before any of the reading. | Make sure to do sanity checking before any of the reading.
| C | lgpl-2.1 | bruceg/bglibs,bruceg/bglibs,bruceg/bglibs,bruceg/bglibs,bruceg/bglibs,bruceg/bglibs |
fc63fb77bf3186b28acea7594e54503083082c95 | boards/common/stm32/include/cfg_usb_otg_fs.h | boards/common/stm32/include/cfg_usb_otg_fs.h | /*
* Copyright (C) 2019 Koen Zandberg
*
* This file is subject to the terms and conditions of the GNU Lesser
* General Public License v2.1. See the file LICENSE in the top level
* directory for more details.
*/
/**
* @ingroup boards_common_stm32
* @{
*
* @file
* @brief Common configuration for STM32 OTG FS peripheral
*
* @author Koen Zandberg <[email protected]>
*/
#ifndef CFG_USB_OTG_FS_H
#define CFG_USB_OTG_FS_H
#include "periph_cpu.h"
#ifdef __cplusplus
extern "C" {
#endif
/**
* @brief Enable the full speed USB OTG peripheral
*/
#define STM32_USB_OTG_FS_ENABLED
/**
* @name common USB OTG FS configuration
* @{
*/
static const stm32_usb_otg_fshs_config_t stm32_usb_otg_fshs_config[] = {
{
.periph = (uint8_t *)USB_OTG_FS_PERIPH_BASE,
.rcc_mask = RCC_AHB2ENR_OTGFSEN,
.phy = STM32_USB_OTG_PHY_BUILTIN,
.type = STM32_USB_OTG_FS,
.irqn = OTG_FS_IRQn,
.ahb = AHB2,
.dm = GPIO_PIN(PORT_A, 11),
.dp = GPIO_PIN(PORT_A, 12),
.af = GPIO_AF10,
}
};
/** @} */
/**
* @brief Number of available USB OTG peripherals
*/
#define USBDEV_NUMOF ARRAY_SIZE(stm32_usb_otg_fshs_config)
#ifdef __cplusplus
}
#endif
#endif /* CFG_USB_OTG_FS_H */
/** @} */
| Add default config for USB OTG FS peripheral | boards/stm32: Add default config for USB OTG FS peripheral
| C | lgpl-2.1 | jasonatran/RIOT,ant9000/RIOT,yogo1212/RIOT,authmillenon/RIOT,OTAkeys/RIOT,basilfx/RIOT,kaspar030/RIOT,jasonatran/RIOT,yogo1212/RIOT,RIOT-OS/RIOT,RIOT-OS/RIOT,yogo1212/RIOT,authmillenon/RIOT,yogo1212/RIOT,OlegHahm/RIOT,RIOT-OS/RIOT,kYc0o/RIOT,ant9000/RIOT,OlegHahm/RIOT,RIOT-OS/RIOT,authmillenon/RIOT,miri64/RIOT,miri64/RIOT,kaspar030/RIOT,kYc0o/RIOT,smlng/RIOT,basilfx/RIOT,jasonatran/RIOT,kaspar030/RIOT,jasonatran/RIOT,miri64/RIOT,kaspar030/RIOT,basilfx/RIOT,yogo1212/RIOT,ant9000/RIOT,smlng/RIOT,kaspar030/RIOT,basilfx/RIOT,authmillenon/RIOT,OTAkeys/RIOT,ant9000/RIOT,smlng/RIOT,RIOT-OS/RIOT,OTAkeys/RIOT,OTAkeys/RIOT,authmillenon/RIOT,jasonatran/RIOT,kYc0o/RIOT,smlng/RIOT,basilfx/RIOT,OlegHahm/RIOT,smlng/RIOT,kYc0o/RIOT,authmillenon/RIOT,miri64/RIOT,miri64/RIOT,OTAkeys/RIOT,yogo1212/RIOT,OlegHahm/RIOT,ant9000/RIOT,kYc0o/RIOT,OlegHahm/RIOT |
|
5d2a4723bcb4ff7913f8ea7e97890aa62d646ccc | include/ctache/lexer.h | include/ctache/lexer.h | /*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
#ifndef LEXER_H
#define LEXER_H
#include <stdlib.h>
#include "linked_list.h"
enum ctache_token_type {
/* Terminals */
CTACHE_TOK_STRING,
CTACHE_TOK_SECTION_TAG_START,
CTACHE_TOK_CLOSE_TAG_START,
CTACHE_TOK_VALUE_TAG_START,
CTACHE_TOK_TAG_END,
CTACHE_TOK_EOI,
/* Non-Terminals */
CTACHE_TOK_TEMPLATE,
CTACHE_TOK_TEXT,
CTACHE_TOK_TAG,
CTACHE_TOK_TAG_START
};
#define CTACHE_NUM_TERMINALS (CTACHE_TOK_EOI + 1)
#define CTACHE_NUM_NONTERMINALS (CTACHE_TOK_TAG_START - CTACHE_TOK_TEMPLATE + 1)
struct ctache_token {
char *value;
enum ctache_token_type tok_type;
};
struct linked_list
*ctache_lex(const char *str, size_t str_len);
#endif /* LEXER_H */
| /*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
#ifndef LEXER_H
#define LEXER_H
#include <stdlib.h>
#include "linked_list.h"
enum ctache_token_type {
/* Terminals */
CTACHE_TOK_SECTION_TAG_START,
CTACHE_TOK_CLOSE_TAG_START,
CTACHE_TOK_VALUE_TAG_START,
CTACHE_TOK_TAG_END,
CTACHE_TOK_STRING,
CTACHE_TOK_EOI,
/* Non-Terminals */
CTACHE_TOK_TEMPLATE,
CTACHE_TOK_TEXT,
CTACHE_TOK_TAG,
CTACHE_TOK_TAG_START
};
#define CTACHE_NUM_TERMINALS (CTACHE_TOK_EOI + 1)
#define CTACHE_NUM_NONTERMINALS (CTACHE_TOK_TAG_START - CTACHE_TOK_TEMPLATE + 1)
struct ctache_token {
char *value;
enum ctache_token_type tok_type;
};
struct linked_list
*ctache_lex(const char *str, size_t str_len);
#endif /* LEXER_H */
| Fix a lexical token ordering issue | Fix a lexical token ordering issue
| C | mpl-2.0 | dwjackson/ctache,dwjackson/ctache |
cf1943751de987986a59a5a458070a7bf4548fee | Josh_Zane_Sebastian/src/parser/types.c | Josh_Zane_Sebastian/src/parser/types.c | #include <stdlib.h>
#include <stdio.h>
struct llnode;
struct symbol;
struct function;
union value;
struct variable;
struct statement;
struct call;
struct llnode {
struct type* car;
struct llnode* cdr;
};
struct call {
char* name;
struct function func;
struct symbol* arguments;
int numargs;
}
struct symbol {//I guess this is analogous to a symbol in lisp.
char* name; //It has a name, which we use to keep track of it.
struct variable* referant; //And an actual value in memory.
};
struct function {
struct symbol* args; //these are the symbols that the function takes as arguments
char* definition; // this is the function's actual definition, left in text form until parsing.
};
union value { //we have three primitive types, so every variable's value is one of those types
char bit;
struct llnode list;
struct function func;
};
struct variable { //this is essentially an in-program variable
union value val; //it has a value, i.e. what it equals
char typeid; //and a type id that allows us to correctly extract the value from the union value.
};
| #include <stdlib.h>
#include <stdio.h>
struct llnode;
struct symbol;
struct function;
union value;
struct variable;
struct statement;
struct call;
struct llnode {
struct variable* car;
struct llnode* cdr;
};
struct call {
char* name;
struct function func;
struct symbol* arguments;
int numargs;
}
struct symbol {//I guess this is analogous to a symbol in lisp.
char* name; //It has a name, which we use to keep track of it.
struct variable* referant; //And an actual value in memory.
};
struct function {
struct symbol* args; //these are the symbols that the function takes as arguments
char* definition; // this is the function's actual definition, left in text form until parsing.
int numargs;
};
union value { //we have three primitive types, so every variable's value is one of those types
char bit;
struct llnode list;
struct function func;
};
struct variable { //this is essentially an in-program variable
union value val; //it has a value, i.e. what it equals
char typeid; //and a type id that allows us to correctly extract the value from the union value.
};
| Add a numargs field to struct function, which refers to the number of arguments the function takes. | Add a numargs field to struct function, which refers to the number of arguments the function takes.
| C | mit | aacoppa/final,aacoppa/final |
ef1a586474d7df11fda2a7c3064418e173c38055 | include/parrot/trace.h | include/parrot/trace.h | /* trace.h
* Copyright: (When this is determined...it will go here)
* CVS Info
* $Id$
* Overview:
* Tracing support for runops_cores.c.
* Data Structure and Algorithms:
* History:
* Notes:
* References:
*/
#ifndef PARROT_TRACE_H_GUARD
#define PARROT_TRACE_H_GUARD
#include "parrot/parrot.h"
void trace_op_dump(struct Parrot_Interp *interpreter, opcode_t *code_start,
opcode_t *pc);
void trace_op(struct Parrot_Interp *interpreter, opcode_t *code_start,
opcode_t *code_end, opcode_t *pc);
void trace_op_b0(struct Parrot_Interp *interpreter, opcode_t *code_start,
opcode_t *pc);
void trace_op_b1(struct Parrot_Interp *interpreter, opcode_t *code_start,
opcode_t *code_end, code_t *pc);
#endif
/*
* Local variables:
* c-indentation-style: bsd
* c-basic-offset: 4
* indent-tabs-mode: nil
* End:
*
* vim: expandtab shiftwidth=4:
*/
| /* trace.h
* Copyright: (When this is determined...it will go here)
* CVS Info
* $Id$
* Overview:
* Tracing support for runops_cores.c.
* Data Structure and Algorithms:
* History:
* Notes:
* References:
*/
#ifndef PARROT_TRACE_H_GUARD
#define PARROT_TRACE_H_GUARD
#include "parrot/parrot.h"
void trace_op_dump(struct Parrot_Interp *interpreter, opcode_t *code_start,
opcode_t *pc);
void trace_op(struct Parrot_Interp *interpreter, opcode_t *code_start,
opcode_t *code_end, opcode_t *pc);
void trace_op_b0(struct Parrot_Interp *interpreter, opcode_t *code_start,
opcode_t *pc);
void trace_op_b1(struct Parrot_Interp *interpreter, opcode_t *code_start,
opcode_t *code_end, opcode_t *pc);
#endif
/*
* Local variables:
* c-indentation-style: bsd
* c-basic-offset: 4
* indent-tabs-mode: nil
* End:
*
* vim: expandtab shiftwidth=4:
*/
| Fix a typo in the argument type. | Fix a typo in the argument type.
Patch from <[email protected]>
git-svn-id: 6e74a02f85675cec270f5d931b0f6998666294a3@1106 d31e2699-5ff4-0310-a27c-f18f2fbe73fe
| C | artistic-2.0 | gagern/parrot,FROGGS/parrot,parrot/parrot,youprofit/parrot,parrot/parrot,tkob/parrot,FROGGS/parrot,fernandobrito/parrot,FROGGS/parrot,tkob/parrot,parrot/parrot,tkob/parrot,gagern/parrot,gitster/parrot,FROGGS/parrot,gitster/parrot,tkob/parrot,tewk/parrot-select,fernandobrito/parrot,gagern/parrot,fernandobrito/parrot,gagern/parrot,parrot/parrot,gitster/parrot,fernandobrito/parrot,tewk/parrot-select,youprofit/parrot,youprofit/parrot,youprofit/parrot,youprofit/parrot,gagern/parrot,tewk/parrot-select,tewk/parrot-select,tkob/parrot,youprofit/parrot,gagern/parrot,fernandobrito/parrot,tewk/parrot-select,tkob/parrot,fernandobrito/parrot,FROGGS/parrot,FROGGS/parrot,tkob/parrot,youprofit/parrot,youprofit/parrot,gitster/parrot,tkob/parrot,gitster/parrot,gitster/parrot,tewk/parrot-select,gitster/parrot,tewk/parrot-select,FROGGS/parrot,FROGGS/parrot,fernandobrito/parrot,gagern/parrot,parrot/parrot |
cc91506dc6cef57bed963d9e4d3aa002624d7a8b | drake/systems/plants/material_map.h | drake/systems/plants/material_map.h | #pragma once
#include <string>
#include <map>
#include <Eigen/Dense>
typedef std::map<std::string, Eigen::Vector4d, std::less<std::string>,
Eigen::aligned_allocator<
std::pair<std::string, Eigen::Vector4d> > > MaterialMap;
| #pragma once
#include <string>
#include <map>
#include <Eigen/Dense>
typedef std::map<std::string, Eigen::Vector4d, std::less<std::string>,
Eigen::aligned_allocator<
std::pair<const std::string,
Eigen::Vector4d> > > MaterialMap;
| Use pair<'const' Key, Value> in defining MaterialMap type | Use pair<'const' Key, Value> in defining MaterialMap type
Custom allocator to std::map should have std::pair<const Key, Value>
instead of pair<Key, Value>. libc++-3.8.0 actually started checking this
condition by adding static_assert. Without this patch, users (using
libc++>=3.8) see something like the following compiler error message:
/usr/local/Cellar/llvm/3.8.1/bin/../include/c++/v1/map:837:5: error: static_assert failed "Allocator::value_type must be same type as value_type"
static_assert((is_same<typename allocator_type::value_type, value_type>::value),
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/<PATH_TO_DRAKE>/drake/systems/plants/parser_urdf.cc:155:33: note: in instantiation of template class 'std::__1::map<std::__1::basic_string<char>, Eigen::Matrix<double, 4, 1, 0, 4, 1>, std::__1::less<std::__1::basic_string<char> >, Eigen::aligned_allocator<std::__1::pair<std::__1::basic_string<char>, Eigen::Matrix<double, 4, 1, 0, 4, 1> > > >' requested here
auto material_iter = materials->find(material_name);
| C | bsd-3-clause | sheim/drake,sheim/drake,sheim/drake,billhoffman/drake,sheim/drake,billhoffman/drake,sheim/drake,sheim/drake,billhoffman/drake,billhoffman/drake,sheim/drake,billhoffman/drake,sheim/drake,billhoffman/drake,billhoffman/drake,billhoffman/drake |
83dd74f6a0bf69102f807cfb9a904fce2b185594 | utils/lstopo-xml.c | utils/lstopo-xml.c | /*
* Copyright © 2009 CNRS
* Copyright © 2009-2010 INRIA. All rights reserved.
* Copyright © 2009 Université Bordeaux 1
* Copyright © 2009-2011 Cisco Systems, Inc. All rights reserved.
* See COPYING in top-level directory.
*/
#include <private/autogen/config.h>
#ifdef HWLOC_HAVE_XML
#include <hwloc.h>
#include <string.h>
#include "lstopo.h"
void output_xml(hwloc_topology_t topology, const char *filename, int logical __hwloc_attribute_unused, int legend __hwloc_attribute_unused, int verbose_mode __hwloc_attribute_unused)
{
if (!filename || !strcasecmp(filename, "-.xml"))
filename = "-";
hwloc_topology_export_xml(topology, filename);
}
#endif /* HWLOC_HAVE_XML */
| /*
* Copyright © 2009 CNRS
* Copyright © 2009-2010 INRIA. All rights reserved.
* Copyright © 2009 Université Bordeaux 1
* Copyright © 2009-2011 Cisco Systems, Inc. All rights reserved.
* See COPYING in top-level directory.
*/
#include <private/autogen/config.h>
#ifdef HWLOC_HAVE_XML
#include <hwloc.h>
#include <string.h>
#include "lstopo.h"
void output_xml(hwloc_topology_t topology, const char *filename, int logical __hwloc_attribute_unused, int legend __hwloc_attribute_unused, int verbose_mode __hwloc_attribute_unused)
{
if (!filename || !strcasecmp(filename, "-.xml"))
filename = "-";
if (hwloc_topology_export_xml(topology, filename) < 0) {
fprintf(stderr, "Failed to export XML to %s (%s)\n", filename, strerror(errno));
return;
}
}
#endif /* HWLOC_HAVE_XML */
| Print an error when lstopo fails to export to X... | Print an error when lstopo fails to export to X...
Print an error when lstopo fails to export to XML
This commit was SVN r3691.
| C | bsd-3-clause | ggouaillardet/hwloc,shekkbuilder/hwloc,shekkbuilder/hwloc,ggouaillardet/hwloc,shekkbuilder/hwloc,ggouaillardet/hwloc,ggouaillardet/hwloc,shekkbuilder/hwloc |
02d32b05a69c125b9c30d7002f023de4bd55ab4b | src/auth/userdb-passwd.c | src/auth/userdb-passwd.c | /* Copyright (C) 2002-2003 Timo Sirainen */
#include "config.h"
#undef HAVE_CONFIG_H
#ifdef USERDB_PASSWD
#include "common.h"
#include "userdb.h"
#include <pwd.h>
static void passwd_lookup(const char *user, userdb_callback_t *callback,
void *context)
{
struct user_data data;
struct passwd *pw;
pw = getpwnam(user);
if (pw == NULL) {
if (errno != 0)
i_error("getpwnam(%s) failed: %m", user);
else if (verbose)
i_info("passwd(%s): unknown user", user);
callback(NULL, context);
return;
}
memset(&data, 0, sizeof(data));
data.uid = pw->pw_uid;
data.gid = pw->pw_gid;
data.virtual_user = data.system_user = pw->pw_name;
data.home = pw->pw_dir;
callback(&data, context);
}
struct userdb_module userdb_passwd = {
NULL, NULL,
passwd_lookup
};
#endif
| /* Copyright (C) 2002-2003 Timo Sirainen */
#include "config.h"
#undef HAVE_CONFIG_H
#ifdef USERDB_PASSWD
#include "common.h"
#include "userdb.h"
#include <pwd.h>
static void passwd_lookup(const char *user, userdb_callback_t *callback,
void *context)
{
struct user_data data;
struct passwd *pw;
size_t len;
pw = getpwnam(user);
if (pw == NULL) {
if (errno != 0)
i_error("getpwnam(%s) failed: %m", user);
else if (verbose)
i_info("passwd(%s): unknown user", user);
callback(NULL, context);
return;
}
memset(&data, 0, sizeof(data));
data.uid = pw->pw_uid;
data.gid = pw->pw_gid;
data.virtual_user = data.system_user = pw->pw_name;
len = strlen(pw->pw_dir);
if (len < 3 || strcmp(pw->pw_dir + len - 3, "/./") != 0)
data.home = pw->pw_dir;
else {
/* wu-ftpd uses <chroot>/./<dir>. We don't support
the dir after chroot, but this should work well enough. */
data.home = t_strndup(pw->pw_dir, len-3);
data.chroot = TRUE;
}
callback(&data, context);
}
struct userdb_module userdb_passwd = {
NULL, NULL,
passwd_lookup
};
#endif
| Support wu-ftpd-like chrooting in /etc/passwd. If home directory ends with "/./", it's chrooted to. | Support wu-ftpd-like chrooting in /etc/passwd. If home directory ends with
"/./", it's chrooted to.
--HG--
branch : HEAD
| C | mit | jkerihuel/dovecot,jwm/dovecot-notmuch,jwm/dovecot-notmuch,jwm/dovecot-notmuch,jwm/dovecot-notmuch,jkerihuel/dovecot,dscho/dovecot,jkerihuel/dovecot,dscho/dovecot,jkerihuel/dovecot,dscho/dovecot,dscho/dovecot,jkerihuel/dovecot,jwm/dovecot-notmuch,dscho/dovecot |
92f0a3f1d26eb0a1513a94caa17de980a4979558 | software/infnoise.h | software/infnoise.h | #include <stdbool.h>
#include <stdint.h>
#include <sys/types.h>
#include <ftdi.h>
// Structure for parsed command line options
struct opt_struct {
uint32_t outputMultiplier; // We output all the entropy when outputMultiplier == 0
bool daemon; // Run as daemon?
bool debug; // Print debugging info?
bool devRandom; // Feed /dev/random?
bool noOutput; // Supress output?
bool listDevices; // List possible USB-devices?
bool help; // Show help
bool none; // set to true when no valid arguments where detected
bool raw; // No whitening?
bool version; // Show version
char *pidFileName; // Name of optional PID-file
char *serial; // Name of selected device
};
void startDaemon(struct opt_struct *opts);
| #include <stdbool.h>
#include <stdint.h>
#include <sys/types.h>
#include <linux/limits.h>
#include <ftdi.h>
// Structure for parsed command line options
struct opt_struct {
uint32_t outputMultiplier; // We output all the entropy when outputMultiplier == 0
bool daemon; // Run as daemon?
bool debug; // Print debugging info?
bool devRandom; // Feed /dev/random?
bool noOutput; // Supress output?
bool listDevices; // List possible USB-devices?
bool help; // Show help
bool none; // set to true when no valid arguments where detected
bool raw; // No whitening?
bool version; // Show version
char *pidFileName; // Name of optional PID-file
char *serial; // Name of selected device
};
void startDaemon(struct opt_struct *opts);
| Fix related to missing include (PATH_MAX) | Fix related to missing include (PATH_MAX)
| C | cc0-1.0 | manuel-domke/infnoise,manuel-domke/infnoise,waywardgeek/infnoise,manuel-domke/infnoise,manuel-domke/infnoise,waywardgeek/infnoise,waywardgeek/infnoise,manuel-domke/infnoise,waywardgeek/infnoise |
f784d4fd6fa0dc156d4512f40df337e6cc7c1f3c | SC4Fix/patcher.h | SC4Fix/patcher.h | #pragma once
#include <stdint.h>
#define ASMJMP(a) _asm { mov CPatcher::uJumpBuffer, a } _asm { jmp CPatcher::uJumpBuffer }
typedef void (*tfnHookFunc)(void);
class CPatcher {
public:
static void InstallHook(uint32_t uAddress, void (*pfnFunc)(void));
static void UninstallHook(uint32_t uAddress, uint8_t uFirstByte, uint32_t uOtherBytes);
static void InstallCallHook(uint32_t uAddress, void (*pfnFunc)(void));
static void InstallMethodHook(uint32_t uAddress, void (*pfnFunc)(void));
static void UnprotectAll(void);
static uint32_t uJumpBuffer;
}; | #pragma once
#include <stdint.h>
#define ASMJMP(a) _asm { mov CPatcher::uJumpBuffer, a } _asm { jmp CPatcher::uJumpBuffer }
#define RETJMP(a) _asm { push a } _asm { ret }
typedef void (*tfnHookFunc)(void);
class CPatcher {
public:
static void InstallHook(uint32_t uAddress, void (*pfnFunc)(void));
static void UninstallHook(uint32_t uAddress, uint8_t uFirstByte, uint32_t uOtherBytes);
static void InstallCallHook(uint32_t uAddress, void (*pfnFunc)(void));
static void InstallMethodHook(uint32_t uAddress, void (*pfnFunc)(void));
static void UnprotectAll(void);
static uint32_t uJumpBuffer;
}; | Add RETJMP for jumping to dynamic addresses | Add RETJMP for jumping to dynamic addresses
| C | mit | nsgomez/sc4fix,nsgomez/sc4fix,nsgomez/sc4fix |
a42dff69c2d9260223aa34c0c5c23ab7128644a7 | gnu/lib/libdialog/notify.c | gnu/lib/libdialog/notify.c | /*
* File: notify.c
* Author: Marc van Kempen
* Desc: display a notify box with a message
*
* Copyright (c) 1995, Marc van Kempen
*
* All rights reserved.
*
* This software may be used, modified, copied, distributed, and
* sold, in both source and binary form provided that the above
* copyright and these terms are retained, verbatim, as the first
* lines of this file. Under no circumstances is the author
* responsible for the proper functioning of this software, nor does
* the author assume any responsibility for damages incurred with
* its use.
*
*/
#include <dialog.h>
#include <stdio.h>
void
dialog_notify(char *msg)
/*
* Desc: display an error message
*/
{
char *tmphlp;
WINDOW *w;
w = dupwin(newscr);
if (w == NULL) {
endwin();
fprintf(stderr, "\ndupwin(newscr) failed, malloc memory corrupted\n");
exit(1);
}
tmphlp = get_helpline();
use_helpline("Press enter to continue");
dialog_mesgbox("Message", msg, -1, -1, TRUE);
restore_helpline(tmphlp);
touchwin(w);
wrefresh(w);
delwin(w);
return;
} /* dialog_notify() */
| /*
* File: notify.c
* Author: Marc van Kempen
* Desc: display a notify box with a message
*
* Copyright (c) 1995, Marc van Kempen
*
* All rights reserved.
*
* This software may be used, modified, copied, distributed, and
* sold, in both source and binary form provided that the above
* copyright and these terms are retained, verbatim, as the first
* lines of this file. Under no circumstances is the author
* responsible for the proper functioning of this software, nor does
* the author assume any responsibility for damages incurred with
* its use.
*
*/
#include <dialog.h>
#include <stdio.h>
void
dialog_notify(char *msg)
/*
* Desc: display an error message
*/
{
char *tmphlp;
WINDOW *w;
w = dupwin(newscr);
if (w == NULL) {
endwin();
fprintf(stderr, "\ndupwin(newscr) failed, malloc memory corrupted\n");
exit(1);
}
tmphlp = get_helpline();
use_helpline("Press enter to continue");
dialog_mesgbox("Message", msg, -1, -1);
restore_helpline(tmphlp);
touchwin(w);
wrefresh(w);
delwin(w);
return;
} /* dialog_notify() */
| Remove extra argument from mesgbox | Remove extra argument from mesgbox
| C | bsd-3-clause | jrobhoward/SCADAbase,jrobhoward/SCADAbase,jrobhoward/SCADAbase,jrobhoward/SCADAbase,jrobhoward/SCADAbase,jrobhoward/SCADAbase,jrobhoward/SCADAbase,jrobhoward/SCADAbase,jrobhoward/SCADAbase,jrobhoward/SCADAbase,jrobhoward/SCADAbase |
e5135809c3e77f8f1cf0e84840220c789421b712 | src/OsmTileSource.h | src/OsmTileSource.h | /*
* OsmTileSource.h
* RunParticles
*
* Created by Doug Letterman on 6/30/14.
* Copyright 2014 Doug Letterman. All rights reserved.
*
*/
#ifndef OSMTILESOURCE_H
#define OSMTILESOURCE_H
#include <QObject>
#include <QNetworkAccessManager>
#include <QNetworkReply>
#include "Singleton.h"
#include "math.h"
struct OsmTile {
unsigned int x, y, z;
};
template<typename T>
struct OsmTileHash
{
std::size_t operator()(const T& t) const
{
unsigned int offset = 0;
for (unsigned int i=1; i < t.z; i++) {
offset += pow(2, 2*i);
}
unsigned int edge = pow(2, t.z);
return std::size_t(offset + t.x * edge + t.y);
}
};
class OsmTileSource : public QObject
{
Q_OBJECT
public:
void getTile(int x, int y, int z);
signals:
void tileReady(int x, int y, int z);
public slots:
void onRequestFinished(QNetworkReply *reply);
protected:
};
#endif
| /*
* OsmTileSource.h
* RunParticles
*
* Created by Doug Letterman on 6/30/14.
* Copyright 2014 Doug Letterman. All rights reserved.
*
*/
#ifndef OSMTILESOURCE_H
#define OSMTILESOURCE_H
#include <QObject>
#include <QNetworkAccessManager>
#include <QNetworkReply>
#include "Singleton.h"
#include "math.h"
struct OsmTile {
unsigned int x, y, z;
};
template<typename T>
struct OsmTileHash
{
std::size_t operator()(const T& t) const
{
unsigned long offset = 0;
for (int i=1; i < t.z; i++) {
offset += pow(2, 2*i);
}
int edge = pow(2, t.z);
return std::size_t(offset + t.x * edge + t.y);
}
};
class OsmTileSource : public QObject
{
Q_OBJECT
public:
void getTile(int x, int y, int z);
signals:
void tileReady(int x, int y, int z);
public slots:
void onRequestFinished(QNetworkReply *reply);
protected:
};
#endif
| Use an unsigned long offset instead of int. | Use an unsigned long offset instead of int.
| C | mit | dal/RunParticles,dal/RunParticles,dal/RunParticles |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.