id stringlengths 21 132 | codebase stringclasses 57
values | c_file stringlengths 3 108 | function stringlengths 3 74 | sloc stringclasses 134
values | c_code stringlengths 25 52.1k | c_constructs dict |
|---|---|---|---|---|---|---|
rcs-5.10.1#rcsutil_prep#chk_set_rev.c | rcs-5.10.1 | rcsutil.c | chk_set_rev | 9 | void
chk_set_rev (const char **rev, char *arg)
{
if (! *arg)
return;
if (*rev)
generic_warn (((void *)0), "redefinition of %s", ks_revno);
*rev = arg;
}
| {
"array_type": 0,
"break_continue_statement": 0,
"enum_type": 0,
"for_loop": 0,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 2,
"memory_management": 0,
"memory_operation": 0,
"pointer_type": 0,
"return_statement": 1,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 1,
"union_type": 0,
"while_loop": 0
} |
transcoder-set#FIND_WHETHER_A_GIVEN_NUMBER_IS_A_POWER_OF_4_OR_NOT_2_prep#sort.c | transcoder-set | FIND_WHETHER_A_GIVEN_NUMBER_IS_A_POWER_OF_4_OR_NOT_2.c | sort | 1 | void sort (int arr [ ], int n) {qsort (arr, n, sizeof(int), cmpfunc);}
| {
"array_type": 0,
"break_continue_statement": 0,
"enum_type": 0,
"for_loop": 0,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 0,
"memory_management": 0,
"memory_operation": 0,
"pointer_type": 0,
"return_statement": 0,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 1,
"union_type": 0,
"while_loop": 0
} |
transcoder-set#PYTHAGOREAN_QUADRUPLE_prep#main.c | transcoder-set | PYTHAGOREAN_QUADRUPLE.c | main | 17 | int main(void) {
int n_success = 0;
int param0[] = {1,3,0,-1,82,14,6,13,96,70};
int param1[] = {2,2,0,-1,79,57,96,7,65,33};
int param2[] = {2,5,0,-1,6,35,45,3,72,6};
int param3[] = {3,38,0,1,59,29,75,63,93,2};
for(int i = 0; i < len(param0); ++i)
{
if(f_filled(param0[i],param1[i],param2[i],param3[i]) == f_gold(param0[i],param1[i],param2[i],param3[i]))
{
n_success+=1;
}
break;
}
printf("#Results:", " ", n_success, ", ", len(param0));
return 0;
}
| {
"array_type": 4,
"break_continue_statement": 1,
"enum_type": 0,
"for_loop": 1,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 1,
"memory_management": 0,
"memory_operation": 0,
"pointer_type": 0,
"return_statement": 1,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 1,
"union_type": 0,
"while_loop": 0
} |
libosip2-5.3.1#port_thread_prep#osip_thread_exit.c | libosip2-5.3.1 | port_thread.c | osip_thread_exit | 3 | void osip_thread_exit() {
pthread_exit(((void *)0));
}
| {
"array_type": 0,
"break_continue_statement": 0,
"enum_type": 0,
"for_loop": 0,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 0,
"memory_management": 0,
"memory_operation": 0,
"pointer_type": 0,
"return_statement": 0,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 1,
"union_type": 0,
"while_loop": 0
} |
mcsim-6.2.0#simi_prep#GetStringArg.c | mcsim-6.2.0 | simi.c | GetStringArg | 18 | BOOL GetStringArg (PINPUTBUF pibIn, PSTR *pszArg, PSTR szLex, BOOL bDelim)
{
BOOL bErr;
((void) sizeof ((szLex) ? 1 : 0), __extension__ ({ if (szLex) ; else __assert_fail ("szLex", "simi.c", 1155, __extension__ __PRETTY_FUNCTION__); }));
if (bDelim)
GetOptPunct(pibIn, szLex, ',');
bErr = ENextLex(pibIn, szLex, 0x0010);
if (!bErr) {
if (szLex[0]) {
if ( !(*pszArg = (PSTR) malloc(((szLex) ? strlen((szLex)) : (int) 0) + 1)))
ReportError(pibIn, 0x0004 | 0x8000, "GetStringArg", ((void *)0));
((*pszArg) && (szLex) ? strcpy((*pszArg), (szLex)) : ((void *)0));
}
else
*pszArg = ((void *)0);
}
return(bErr);
}
| {
"array_type": 1,
"break_continue_statement": 0,
"enum_type": 0,
"for_loop": 0,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 5,
"memory_management": 1,
"memory_operation": 0,
"pointer_type": 0,
"return_statement": 1,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 5,
"union_type": 0,
"while_loop": 0
} |
tmux#screen-write_prep#screen_write_insertline.c | tmux | screen-write.c | screen_write_insertline | 35 | void
screen_write_insertline(struct screen_write_ctx *ctx, u_int ny, u_int bg)
{
struct screen *s = ctx->s;
struct grid *gd = s->grid;
struct tty_ctx ttyctx;
if (ny == 0)
ny = 1;
if (s->cy < s->rupper || s->cy > s->rlower) {
if (ny > ((s)->grid->sy) - s->cy)
ny = ((s)->grid->sy) - s->cy;
if (ny == 0)
return;
screen_write_initctx(ctx, &ttyctx);
ttyctx.bg = bg;
grid_view_insert_lines(gd, s->cy, ny, bg);
screen_write_collect_flush(ctx, 0);
ttyctx.num = ny;
tty_write(tty_cmd_insertline, &ttyctx);
return;
}
if (ny > s->rlower + 1 - s->cy)
ny = s->rlower + 1 - s->cy;
if (ny == 0)
return;
screen_write_initctx(ctx, &ttyctx);
ttyctx.bg = bg;
if (s->cy < s->rupper || s->cy > s->rlower)
grid_view_insert_lines(gd, s->cy, ny, bg);
else
grid_view_insert_lines_region(gd, s->rlower, s->cy, ny, bg);
screen_write_collect_flush(ctx, 0);
ttyctx.num = ny;
tty_write(tty_cmd_insertline, &ttyctx);
}
| {
"array_type": 0,
"break_continue_statement": 0,
"enum_type": 0,
"for_loop": 0,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 7,
"memory_management": 0,
"memory_operation": 0,
"pointer_type": 2,
"return_statement": 3,
"struct_type": 3,
"switch_statement": 0,
"type_casting": 0,
"union_type": 0,
"while_loop": 0
} |
libxml2#libxml2-py_prep#libxml_xmlURIGetFragment.c | libxml2 | libxml2-py.c | libxml_xmlURIGetFragment | 13 | PyObject *
libxml_xmlURIGetFragment(PyObject *self __attribute__ ((__unused__)), PyObject *args) {
PyObject *py_retval;
const char * c_retval;
xmlURIPtr URI;
PyObject *pyobj_URI;
if (!_PyArg_ParseTuple_SizeT(args, (char *)"O:xmlURIGetFragment", &pyobj_URI))
return(((void *)0));
URI = (xmlURIPtr) (((pyobj_URI) == (&_Py_NoneStruct)) ? ((void *)0) : (((PyURI_Object *)(pyobj_URI))->obj));
c_retval = URI->fragment;
py_retval = libxml_charPtrConstWrap((const char *) c_retval);
return(py_retval);
}
| {
"array_type": 0,
"break_continue_statement": 0,
"enum_type": 0,
"for_loop": 0,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 1,
"memory_management": 0,
"memory_operation": 0,
"pointer_type": 2,
"return_statement": 2,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 3,
"union_type": 0,
"while_loop": 0
} |
tmux#screen-write_prep#screen_write_setselection.c | tmux | screen-write.c | screen_write_setselection | 9 | void
screen_write_setselection(struct screen_write_ctx *ctx, u_char *str, u_int len)
{
struct tty_ctx ttyctx;
screen_write_initctx(ctx, &ttyctx);
ttyctx.ptr = str;
ttyctx.num = len;
tty_write(tty_cmd_setselection, &ttyctx);
}
| {
"array_type": 0,
"break_continue_statement": 0,
"enum_type": 0,
"for_loop": 0,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 0,
"memory_management": 0,
"memory_operation": 0,
"pointer_type": 0,
"return_statement": 0,
"struct_type": 1,
"switch_statement": 0,
"type_casting": 0,
"union_type": 0,
"while_loop": 0
} |
findutils-4.9.0#printquoted_prep#print_quoted.c | findutils-4.9.0 | printquoted.c | print_quoted | 35 | int
print_quoted (FILE *fp,
const struct quoting_options *qopts,
_Bool dest_is_tty,
const char *format,
const char *s)
{
int rv;
if (dest_is_tty)
{
char smallbuf[8192];
size_t len = quotearg_buffer (smallbuf, sizeof smallbuf, s, -1, qopts);
char *buf;
if (len < sizeof smallbuf)
buf = smallbuf;
else
{
buf = xmalloc (len + 1);
quotearg_buffer (buf, len + 1, s, -1, qopts);
}
len = qmark_chars (buf, len);
buf[len] = 0;
rv = fprintf (fp, format, buf);
if (buf != smallbuf)
{
free (buf);
buf = ((void *)0);
}
}
else
{
rv = fprintf (fp, format, s);
}
return rv;
}
| {
"array_type": 2,
"break_continue_statement": 0,
"enum_type": 0,
"for_loop": 0,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 3,
"memory_management": 1,
"memory_operation": 0,
"pointer_type": 1,
"return_statement": 1,
"struct_type": 1,
"switch_statement": 0,
"type_casting": 1,
"union_type": 0,
"while_loop": 0
} |
brotli-1.0.9#utf8_util_prep#BrotliIsMostlyUTF8.c | brotli-1.0.9 | utf8_util.c | BrotliIsMostlyUTF8 | 14 | int BrotliIsMostlyUTF8(
const uint8_t* data, const size_t pos, const size_t mask,
const size_t length, const double min_fraction) {
size_t size_utf8 = 0;
size_t i = 0;
while (i < length) {
int symbol;
size_t bytes_read =
BrotliParseAsUTF8(&symbol, &data[(pos + i) & mask], length - i);
i += bytes_read;
if (symbol < 0x110000) size_utf8 += bytes_read;
}
return (!!((double)size_utf8 > min_fraction * (double)length) ? 1 : 0);
}
| {
"array_type": 0,
"break_continue_statement": 0,
"enum_type": 0,
"for_loop": 0,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 1,
"memory_management": 0,
"memory_operation": 0,
"pointer_type": 0,
"return_statement": 1,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 1,
"union_type": 0,
"while_loop": 1
} |
tar-1.34#paxerror_prep#truncate_warn.c | tar-1.34 | paxerror.c | truncate_warn | 5 | void
truncate_warn (char const *name)
{
call_arg_warn ("truncate", name);
}
| {
"array_type": 0,
"break_continue_statement": 0,
"enum_type": 0,
"for_loop": 0,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 0,
"memory_management": 0,
"memory_operation": 0,
"pointer_type": 0,
"return_statement": 0,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 0,
"union_type": 0,
"while_loop": 0
} |
libxml2#xmlsave_prep#xmlSaveFile.c | libxml2 | xmlsave.c | xmlSaveFile | 4 | int
xmlSaveFile(const char *filename, xmlDocPtr cur) {
return(xmlSaveFormatFileEnc(filename, cur, ((void *)0), 0));
}
| {
"array_type": 0,
"break_continue_statement": 0,
"enum_type": 0,
"for_loop": 0,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 0,
"memory_management": 0,
"memory_operation": 0,
"pointer_type": 0,
"return_statement": 1,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 1,
"union_type": 0,
"while_loop": 0
} |
tar-1.34#basename_prep#base_name.c | tar-1.34 | basename.c | base_name | 21 | char *
base_name (char const *name)
{
char const *base = last_component (name);
size_t length;
if (! *base)
return xstrndup (name, base_len (name));
length = base_len (base);
if (((base[length]) == '/'))
length++;
if (((void) (base), 0))
{
char *p = xmalloc (length + 3);
p[0] = '.';
p[1] = '/';
memcpy (p + 2, base, length);
p[length + 2] = '\0';
return p;
}
return xstrndup (base, length);
}
| {
"array_type": 2,
"break_continue_statement": 0,
"enum_type": 0,
"for_loop": 0,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 3,
"memory_management": 0,
"memory_operation": 1,
"pointer_type": 2,
"return_statement": 3,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 1,
"union_type": 0,
"while_loop": 0
} |
json.h#test_prep#json_extract_value_ex.c | json.h | test.c | json_extract_value_ex | 23 | struct json_value_s *json_extract_value_ex(const struct json_value_s *value,
void *(*alloc_func_ptr)(void *,
size_t),
void *user_data) {
void *allocation;
struct json_extract_result_s result;
struct json_extract_state_s state;
size_t total_size;
if (0 == value) {
return 0;
}
result = json_extract_get_value_size(value);
total_size = result.dom_size + result.data_size;
if (0 == alloc_func_ptr) {
allocation = malloc(total_size);
} else {
allocation = alloc_func_ptr(user_data, total_size);
}
state.dom = (char *)allocation;
state.data = state.dom + result.dom_size;
json_extract_copy_value(&state, value);
return (struct json_value_s *)allocation;
}
| {
"array_type": 0,
"break_continue_statement": 0,
"enum_type": 0,
"for_loop": 0,
"function_pointer": 1,
"goto_statement": 0,
"if_statement": 2,
"memory_management": 1,
"memory_operation": 0,
"pointer_type": 1,
"return_statement": 2,
"struct_type": 1,
"switch_statement": 0,
"type_casting": 2,
"union_type": 0,
"while_loop": 0
} |
transcoder-set#TEMPLE_OFFERINGS_prep#sort.c | transcoder-set | TEMPLE_OFFERINGS.c | sort | 1 | void sort (int arr [ ], int n) {qsort (arr, n, sizeof(int), cmpfunc);}
| {
"array_type": 0,
"break_continue_statement": 0,
"enum_type": 0,
"for_loop": 0,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 0,
"memory_management": 0,
"memory_operation": 0,
"pointer_type": 0,
"return_statement": 0,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 1,
"union_type": 0,
"while_loop": 0
} |
nano-7.2#asnprintf_prep#asnprintf.c | nano-7.2 | asnprintf.c | asnprintf | 10 | char *
asnprintf (char *resultbuf, size_t *lengthp, const char *format, ...)
{
va_list args;
char *result;
__builtin_va_start(args,format);
result = vasnprintf (resultbuf, lengthp, format, args);
__builtin_va_end(args);
return result;
}
| {
"array_type": 0,
"break_continue_statement": 0,
"enum_type": 0,
"for_loop": 0,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 0,
"memory_management": 0,
"memory_operation": 0,
"pointer_type": 1,
"return_statement": 1,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 0,
"union_type": 0,
"while_loop": 0
} |
libxml2#uri_prep#xmlParseURISafe.c | libxml2 | uri.c | xmlParseURISafe | 20 | int
xmlParseURISafe(const char *str, xmlURIPtr *uriOut) {
xmlURIPtr uri;
int ret;
if (uriOut == ((void *)0))
return(1);
*uriOut = ((void *)0);
if (str == ((void *)0))
return(1);
uri = xmlCreateURI();
if (uri == ((void *)0))
return(-1);
ret = xmlParse3986URIReference(uri, str);
if (ret) {
xmlFreeURI(uri);
return(ret);
}
*uriOut = uri;
return(0);
}
| {
"array_type": 0,
"break_continue_statement": 0,
"enum_type": 0,
"for_loop": 0,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 4,
"memory_management": 0,
"memory_operation": 0,
"pointer_type": 0,
"return_statement": 5,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 4,
"union_type": 0,
"while_loop": 0
} |
gprolog-1.5.0#c_supp_prep#Pl_Rd_In_Code.c | gprolog-1.5.0 | c_supp.c | Pl_Rd_In_Code | 5 | int
Pl_Rd_In_Code(WamWord start_word)
{
return Pl_Rd_Integer(start_word);
}
| {
"array_type": 0,
"break_continue_statement": 0,
"enum_type": 0,
"for_loop": 0,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 0,
"memory_management": 0,
"memory_operation": 0,
"pointer_type": 0,
"return_statement": 1,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 0,
"union_type": 0,
"while_loop": 0
} |
transcoder-set#COUNT_DISTINCT_OCCURRENCES_AS_A_SUBSEQUENCE_prep#min.c | transcoder-set | COUNT_DISTINCT_OCCURRENCES_AS_A_SUBSEQUENCE.c | min | 1 | int min(int x, int y) { return (x < y)? x: y; }
| {
"array_type": 0,
"break_continue_statement": 0,
"enum_type": 0,
"for_loop": 0,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 0,
"memory_management": 0,
"memory_operation": 0,
"pointer_type": 0,
"return_statement": 1,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 0,
"union_type": 0,
"while_loop": 0
} |
tar-1.34#xmalloc_prep#x2realloc.c | tar-1.34 | xmalloc.c | x2realloc | 5 | void *
x2realloc (void *p, size_t *pn)
{
return x2nrealloc (p, pn, 1);
}
| {
"array_type": 0,
"break_continue_statement": 0,
"enum_type": 0,
"for_loop": 0,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 0,
"memory_management": 0,
"memory_operation": 0,
"pointer_type": 0,
"return_statement": 1,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 0,
"union_type": 0,
"while_loop": 0
} |
heman#mat3_prep#kmMat3Scaling.c | heman | mat3.c | kmMat3Scaling | 7 | kmMat3* kmMat3Scaling(kmMat3* pOut, const float x, const float y)
{
kmMat3Identity(pOut);
pOut->mat[0] = x;
pOut->mat[4] = y;
return pOut;
}
| {
"array_type": 1,
"break_continue_statement": 0,
"enum_type": 0,
"for_loop": 0,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 0,
"memory_management": 0,
"memory_operation": 0,
"pointer_type": 0,
"return_statement": 1,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 0,
"union_type": 0,
"while_loop": 0
} |
transcoder-set#DICE_THROW_PROBLEM_prep#sort.c | transcoder-set | DICE_THROW_PROBLEM.c | sort | 1 | void sort (int arr [ ], int n) {qsort (arr, n, sizeof(int), cmpfunc);}
| {
"array_type": 0,
"break_continue_statement": 0,
"enum_type": 0,
"for_loop": 0,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 0,
"memory_management": 0,
"memory_operation": 0,
"pointer_type": 0,
"return_statement": 0,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 1,
"union_type": 0,
"while_loop": 0
} |
gprolog-1.5.0#linedit_prep#Pl_LE_Get_Current_Position.c | gprolog-1.5.0 | linedit.c | Pl_LE_Get_Current_Position | 5 | int
Pl_LE_Get_Current_Position(void)
{
return global_pos - global_str;
}
| {
"array_type": 0,
"break_continue_statement": 0,
"enum_type": 0,
"for_loop": 0,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 0,
"memory_management": 0,
"memory_operation": 0,
"pointer_type": 0,
"return_statement": 1,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 1,
"union_type": 0,
"while_loop": 0
} |
transcoder-set#FIND_UNIT_DIGIT_X_RAISED_POWER_Y_prep#len.c | transcoder-set | FIND_UNIT_DIGIT_X_RAISED_POWER_Y.c | len | 1 | int len (int arr [ ]) {return ((int) (sizeof (arr) / sizeof (arr)[0]));}
| {
"array_type": 0,
"break_continue_statement": 0,
"enum_type": 0,
"for_loop": 0,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 0,
"memory_management": 0,
"memory_operation": 0,
"pointer_type": 0,
"return_statement": 1,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 1,
"union_type": 0,
"while_loop": 0
} |
libxml2#xmlschemastypes_prep#xmlSchemaValueGetAsBoolean.c | libxml2 | xmlschemastypes.c | xmlSchemaValueGetAsBoolean | 7 | int
xmlSchemaValueGetAsBoolean(xmlSchemaValPtr val)
{
if ((val == ((void *)0)) || (val->type != XML_SCHEMAS_BOOLEAN))
return (0);
return (val->value.b);
}
| {
"array_type": 0,
"break_continue_statement": 0,
"enum_type": 0,
"for_loop": 0,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 1,
"memory_management": 0,
"memory_operation": 0,
"pointer_type": 0,
"return_statement": 2,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 1,
"union_type": 0,
"while_loop": 0
} |
patch-2.7.6#util_prep#savestr.c | patch-2.7.6 | util.c | savestr | 5 | char *
savestr (char const *s)
{
return savebuf (s, strlen (s) + 1);
}
| {
"array_type": 0,
"break_continue_statement": 0,
"enum_type": 0,
"for_loop": 0,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 0,
"memory_management": 0,
"memory_operation": 0,
"pointer_type": 0,
"return_statement": 1,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 0,
"union_type": 0,
"while_loop": 0
} |
libxml2#chvalid_prep#xmlIsChar.c | libxml2 | chvalid.c | xmlIsChar | 4 | int
xmlIsChar(unsigned int ch) {
return((((ch) < 0x100) ? (((0x9 <= ((ch))) && (((ch)) <= 0xa)) || (((ch)) == 0xd) || (0x20 <= ((ch)))) : (((0x100 <= (ch)) && ((ch) <= 0xd7ff)) || ((0xe000 <= (ch)) && ((ch) <= 0xfffd)) || ((0x10000 <= (ch)) && ((ch) <= 0x10ffff)))));
}
| {
"array_type": 0,
"break_continue_statement": 0,
"enum_type": 0,
"for_loop": 0,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 0,
"memory_management": 0,
"memory_operation": 0,
"pointer_type": 0,
"return_statement": 1,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 0,
"union_type": 0,
"while_loop": 0
} |
bc-1.07.1#scan_prep#yy_scan_buffer.c | bc-1.07.1 | scan.c | yy_scan_buffer | 22 | YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size )
{
YY_BUFFER_STATE b;
if ( size < 2 ||
base[size-2] != 0 ||
base[size-1] != 0 )
return 0;
b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) );
if ( ! b )
yy_fatal_error( "out of dynamic memory in yy_scan_buffer()" );
b->yy_buf_size = size - 2;
b->yy_buf_pos = b->yy_ch_buf = base;
b->yy_is_our_buffer = 0;
b->yy_input_file = 0;
b->yy_n_chars = b->yy_buf_size;
b->yy_is_interactive = 0;
b->yy_at_bol = 1;
b->yy_fill_buffer = 0;
b->yy_buffer_status = 0;
yy_switch_to_buffer(b );
return b;
}
| {
"array_type": 0,
"break_continue_statement": 0,
"enum_type": 0,
"for_loop": 0,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 2,
"memory_management": 0,
"memory_operation": 0,
"pointer_type": 0,
"return_statement": 2,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 1,
"union_type": 0,
"while_loop": 0
} |
libosip2-5.3.1#port_condv_prep#osip_cond_timedwait.c | libosip2-5.3.1 | port_condv.c | osip_cond_timedwait | 5 | int osip_cond_timedwait(struct osip_cond *_cond, struct osip_mutex *_mut, const struct timespec *abstime) {
if (!_cond)
return -2;
return pthread_cond_timedwait(&_cond->cv, (pthread_mutex_t *) _mut, (const struct timespec *) abstime);
}
| {
"array_type": 0,
"break_continue_statement": 0,
"enum_type": 0,
"for_loop": 0,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 1,
"memory_management": 0,
"memory_operation": 0,
"pointer_type": 0,
"return_statement": 2,
"struct_type": 1,
"switch_statement": 0,
"type_casting": 0,
"union_type": 0,
"while_loop": 0
} |
transcoder-set#DIVISIBILITY_9_USING_BITWISE_OPERATORS_prep#max.c | transcoder-set | DIVISIBILITY_9_USING_BITWISE_OPERATORS.c | max | 1 | int max(int x, int y) { return (x > y)? x: y; }
| {
"array_type": 0,
"break_continue_statement": 0,
"enum_type": 0,
"for_loop": 0,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 0,
"memory_management": 0,
"memory_operation": 0,
"pointer_type": 0,
"return_statement": 1,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 0,
"union_type": 0,
"while_loop": 0
} |
libxml2#testparser_prep#main.c | libxml2 | testparser.c | main | 22 | int
main(void) {
int err = 0;
err |= testNewDocNode();
err |= testStandaloneWithEncoding();
err |= testUnsupportedEncoding();
err |= testNodeGetContent();
err |= testCFileIO();
err |= testCtxtParseContent();
err |= testBalancedChunk();
err |= testHugePush();
err |= testHugeEncodedChunk();
err |= testHtmlIds();
err |= testHtmlPushWithEncoding();
err |= testReaderEncoding();
err |= testReaderContent();
err |= testReaderXIncludeError();
err |= testWriterClose();
err |= testBuildRelativeUri();
err |= testCharEncConvImpl();
return err;
}
| {
"array_type": 0,
"break_continue_statement": 0,
"enum_type": 0,
"for_loop": 0,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 0,
"memory_management": 0,
"memory_operation": 0,
"pointer_type": 0,
"return_statement": 1,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 1,
"union_type": 0,
"while_loop": 0
} |
heman#color_prep#heman_color_from_cpcf.c | heman | color.c | heman_color_from_cpcf | 25 | heman_image* heman_color_from_cpcf(heman_image* cfield, heman_image* texture)
{
if (!texture) {
return heman_internal_rg(cfield);
}
((void) sizeof ((cfield->nbands == 2) ? 1 : 0), __extension__ ({ if (cfield->nbands == 2) ; else __assert_fail ("cfield->nbands == 2", "/home/melih/storage/Transpiler/Dataset/projects/codebases_v2/heman/src/color.c", 151, __extension__ __PRETTY_FUNCTION__); }));
((void) sizeof ((texture->nbands == 3 || texture->nbands == 4) ? 1 : 0), __extension__ ({ if (texture->nbands == 3 || texture->nbands == 4) ; else __assert_fail ("texture->nbands == 3 || texture->nbands == 4", "/home/melih/storage/Transpiler/Dataset/projects/codebases_v2/heman/src/color.c", 152, __extension__ __PRETTY_FUNCTION__); }));
((void) sizeof ((cfield->width == texture->width) ? 1 : 0), __extension__ ({ if (cfield->width == texture->width) ; else __assert_fail ("cfield->width == texture->width", "/home/melih/storage/Transpiler/Dataset/projects/codebases_v2/heman/src/color.c", 153, __extension__ __PRETTY_FUNCTION__); }));
((void) sizeof ((cfield->height == texture->height) ? 1 : 0), __extension__ ({ if (cfield->height == texture->height) ; else __assert_fail ("cfield->height == texture->height", "/home/melih/storage/Transpiler/Dataset/projects/codebases_v2/heman/src/color.c", 154, __extension__ __PRETTY_FUNCTION__); }));
int w = cfield->width;
int h = cfield->height;
heman_image* target = heman_image_create(w, h, texture->nbands);
float* dst = target->data;
float* src = cfield->data;
int size = w * h;
for (int i = 0; i < size; i++) {
float u = *src++;
float v = *src++;
float* texel = heman_image_texel(texture, u, v);
for (int c = 0; c < texture->nbands; c++) {
*dst++ = *texel++;
}
}
return target;
}
| {
"array_type": 0,
"break_continue_statement": 0,
"enum_type": 0,
"for_loop": 2,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 5,
"memory_management": 0,
"memory_operation": 0,
"pointer_type": 0,
"return_statement": 2,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 4,
"union_type": 0,
"while_loop": 0
} |
nettle-3.9.1#base16-decode_prep#nettle_base16_decode_single.c | nettle-3.9.1 | base16-decode.c | nettle_base16_decode_single | 33 | int
nettle_base16_decode_single(struct base16_decode_ctx *ctx,
uint8_t *dst,
char src)
{
unsigned char usrc = src;
int digit;
if (usrc >= 0x80)
return -1;
digit = hex_decode_table[usrc];
switch (digit)
{
case -1:
return -1;
case -2:
return 0;
default:
((void) sizeof ((digit >= 0) ? 1 : 0), __extension__ ({ if (digit >= 0) ; else __assert_fail ("digit >= 0", "base16-decode.c", 86, __extension__ __PRETTY_FUNCTION__); }));
((void) sizeof ((digit < 0x10) ? 1 : 0), __extension__ ({ if (digit < 0x10) ; else __assert_fail ("digit < 0x10", "base16-decode.c", 87, __extension__ __PRETTY_FUNCTION__); }));
if (ctx->bits)
{
*dst = (ctx->word << 4) | digit;
ctx->bits = 0;
return 1;
}
else
{
ctx->word = digit;
ctx->bits = 4;
return 0;
}
}
}
| {
"array_type": 1,
"break_continue_statement": 0,
"enum_type": 0,
"for_loop": 0,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 4,
"memory_management": 0,
"memory_operation": 0,
"pointer_type": 0,
"return_statement": 5,
"struct_type": 1,
"switch_statement": 1,
"type_casting": 2,
"union_type": 0,
"while_loop": 0
} |
libxml2#globals_prep#__xmlGenericError.c | libxml2 | globals.c | __xmlGenericError | 1 | xmlGenericErrorFunc *__xmlGenericError(void) { return (&xmlGetThreadLocalStorage(0)->gs_xmlGenericError); }
| {
"array_type": 0,
"break_continue_statement": 0,
"enum_type": 0,
"for_loop": 0,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 0,
"memory_management": 0,
"memory_operation": 0,
"pointer_type": 0,
"return_statement": 1,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 1,
"union_type": 0,
"while_loop": 0
} |
libxml2#parserInternals_prep#xmlCtxtSetResourceLoader.c | libxml2 | parserInternals.c | xmlCtxtSetResourceLoader | 8 | void
xmlCtxtSetResourceLoader(xmlParserCtxtPtr ctxt, xmlResourceLoader loader,
void *vctxt) {
if (ctxt == ((void *)0))
return;
ctxt->resourceLoader = loader;
ctxt->resourceCtxt = vctxt;
}
| {
"array_type": 0,
"break_continue_statement": 0,
"enum_type": 0,
"for_loop": 0,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 1,
"memory_management": 0,
"memory_operation": 0,
"pointer_type": 0,
"return_statement": 1,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 1,
"union_type": 0,
"while_loop": 0
} |
libosip2-5.3.1#osip_prep#osip_timers_ist_execute.c | libosip2-5.3.1 | osip.c | osip_timers_ist_execute | 24 | void osip_timers_ist_execute(osip_t *osip) {
osip_transaction_t *tr;
osip_list_iterator_t iterator;
osip_mutex_lock(osip->ist_fastmutex);
tr = (osip_transaction_t *) osip_list_get_first(&osip->osip_ist_transactions, &iterator);
while ((0 != (iterator).actual && (iterator).pos < (iterator).li->nb_elt)) {
osip_event_t *evt;
evt = __osip_ist_need_timer_i_event(tr->ist_context, tr->state, tr->transactionid);
if (evt != ((void *)0))
osip_fifo_add(tr->transactionff, evt);
else {
evt = __osip_ist_need_timer_h_event(tr->ist_context, tr->state, tr->transactionid);
if (evt != ((void *)0))
osip_fifo_add(tr->transactionff, evt);
else {
evt = __osip_ist_need_timer_g_event(tr->ist_context, tr->state, tr->transactionid);
if (evt != ((void *)0))
osip_fifo_add(tr->transactionff, evt);
}
}
tr = (osip_transaction_t *) osip_list_get_next(&iterator);
}
osip_mutex_unlock(osip->ist_fastmutex);
}
| {
"array_type": 0,
"break_continue_statement": 0,
"enum_type": 0,
"for_loop": 0,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 3,
"memory_management": 0,
"memory_operation": 0,
"pointer_type": 2,
"return_statement": 0,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 3,
"union_type": 0,
"while_loop": 1
} |
transcoder-set#FIND_WHETHER_GIVEN_INTEGER_POWER_3_NOT_prep#f_gold.c | transcoder-set | FIND_WHETHER_GIVEN_INTEGER_POWER_3_NOT.c | f_gold | 3 | _Bool f_gold ( int n ) {
return 1162261467 % n == 0;
}
| {
"array_type": 0,
"break_continue_statement": 0,
"enum_type": 0,
"for_loop": 0,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 0,
"memory_management": 0,
"memory_operation": 0,
"pointer_type": 0,
"return_statement": 1,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 0,
"union_type": 0,
"while_loop": 0
} |
libosip2-5.3.1#osip_authorization_prep#osip_authorization_get_version.c | libosip2-5.3.1 | osip_authorization.c | osip_authorization_get_version | 3 | char *osip_authorization_get_version(osip_authorization_t *authorization) {
return authorization->version;
}
| {
"array_type": 0,
"break_continue_statement": 0,
"enum_type": 0,
"for_loop": 0,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 0,
"memory_management": 0,
"memory_operation": 0,
"pointer_type": 0,
"return_statement": 1,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 0,
"union_type": 0,
"while_loop": 0
} |
libxml2#libxml2-py_prep#libxml_xmlTextReaderGetParserLineNumber.c | libxml2 | libxml2-py.c | libxml_xmlTextReaderGetParserLineNumber | 13 | PyObject *
libxml_xmlTextReaderGetParserLineNumber(PyObject *self __attribute__ ((__unused__)), PyObject *args) {
PyObject *py_retval;
int c_retval;
xmlTextReaderPtr reader;
PyObject *pyobj_reader;
if (!_PyArg_ParseTuple_SizeT(args, (char *)"O:xmlTextReaderGetParserLineNumber", &pyobj_reader))
return(((void *)0));
reader = (xmlTextReaderPtr) (((pyobj_reader) == (&_Py_NoneStruct)) ? ((void *)0) : (((PyxmlTextReader_Object *)(pyobj_reader))->obj));
c_retval = xmlTextReaderGetParserLineNumber(reader);
py_retval = libxml_intWrap((int) c_retval);
return(py_retval);
}
| {
"array_type": 0,
"break_continue_statement": 0,
"enum_type": 0,
"for_loop": 0,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 1,
"memory_management": 0,
"memory_operation": 0,
"pointer_type": 2,
"return_statement": 2,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 4,
"union_type": 0,
"while_loop": 0
} |
heman#distance_prep#heman_distance_from_cpcf.c | heman | distance.c | heman_distance_from_cpcf | 17 | heman_image* heman_distance_from_cpcf(heman_image* cf)
{
((void) sizeof ((cf->nbands == 2 && "Coordinate field input must have 2 bands.") ? 1 : 0), __extension__ ({ if (cf->nbands == 2 && "Coordinate field input must have 2 bands.") ; else __assert_fail ("cf->nbands == 2 && \"Coordinate field input must have 2 bands.\"", "/home/melih/storage/Transpiler/Dataset/projects/codebases_v2/heman/src/distance.c", 259, __extension__ __PRETTY_FUNCTION__); }));
heman_image* udf = heman_image_create(cf->width, cf->height, 1);
float* dptr = udf->data;
float* sptr = cf->data;
float scale = 1.0f / sqrt(((cf->width) * (cf->width)) + ((cf->height) * (cf->height)));
for (int y = 0; y < cf->height; y++) {
for (int x = 0; x < cf->width; x++) {
float u = *sptr++;
float v = *sptr++;
float dist = sqrt(((u - x) * (u - x)) + ((v - y) * (v - y))) * scale;
*dptr++ = dist;
}
}
return udf;
}
| {
"array_type": 0,
"break_continue_statement": 0,
"enum_type": 0,
"for_loop": 2,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 1,
"memory_management": 0,
"memory_operation": 0,
"pointer_type": 0,
"return_statement": 1,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 1,
"union_type": 0,
"while_loop": 0
} |
urlparser#gen_char_category_table_prep#fill.c | urlparser | gen_char_category_table.c | fill | 11 | void fill(unsigned value, const char* alnum, const char* special)
{
for(;*alnum;++alnum)
{
char_cat[ (unsigned char)(*alnum) ] |= value;
}
for(;*special;++special)
{
char_cat[ (unsigned char)(*special) ] |= value;
}
}
| {
"array_type": 0,
"break_continue_statement": 0,
"enum_type": 0,
"for_loop": 2,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 0,
"memory_management": 0,
"memory_operation": 0,
"pointer_type": 0,
"return_statement": 0,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 0,
"union_type": 0,
"while_loop": 0
} |
buffer-0.4.0#buffer_prep#buffer_append_n.c | buffer-0.4.0 | buffer.c | buffer_append_n | 13 | int
buffer_append_n(buffer_t *self, const char *str, size_t len) {
size_t prev = strlen(self->data);
size_t needed = len + prev;
if (self->len > needed) {
strncat(self->data, str, len);
return 0;
}
int ret = buffer_resize(self, needed);
if (-1 == ret) return -1;
strncat(self->data, str, len);
return 0;
}
| {
"array_type": 0,
"break_continue_statement": 0,
"enum_type": 0,
"for_loop": 0,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 2,
"memory_management": 0,
"memory_operation": 0,
"pointer_type": 0,
"return_statement": 3,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 0,
"union_type": 0,
"while_loop": 0
} |
uucp-1.07#statsb_prep#fsysdep_touch_file.c | uucp-1.07 | statsb.c | fsysdep_touch_file | 11 | boolean
fsysdep_touch_file (zfile)
const char *zfile;
{
if (issettime (zfile, time ((time_t *) ((void *)0))) != 0)
{
ulog (LOG_ERROR, "utime (%s): %s", zfile, strerror ((*__errno_location ())));
return (0);
}
return (1);
}
| {
"array_type": 0,
"break_continue_statement": 0,
"enum_type": 0,
"for_loop": 0,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 1,
"memory_management": 0,
"memory_operation": 0,
"pointer_type": 0,
"return_statement": 2,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 1,
"union_type": 0,
"while_loop": 0
} |
json.h#allow_inf_and_nan_prep#json_write_pretty.c | json.h | allow_inf_and_nan.c | json_write_pretty | 42 | void *json_write_pretty(const struct json_value_s *value, const char *indent,
const char *newline, size_t *out_size) {
size_t size = 0;
size_t indent_size = 0;
size_t newline_size = 0;
char *data = 0;
char *data_end = 0;
if (0 == value) {
return 0;
}
if (0 == indent) {
indent = " ";
}
if (0 == newline) {
newline = "\n";
}
while ('\0' != indent[indent_size]) {
++indent_size;
}
while ('\0' != newline[newline_size]) {
++newline_size;
}
if (json_write_pretty_get_value_size(value, 0, indent_size, newline_size,
&size)) {
return 0;
}
size += 1;
data = (char *)malloc(size);
if (0 == data) {
return 0;
}
data_end = json_write_pretty_value(value, 0, indent, newline, data);
if (0 == data_end) {
free(data);
return 0;
}
*data_end = '\0';
if (0 != out_size) {
*out_size = size;
}
return data;
}
| {
"array_type": 2,
"break_continue_statement": 0,
"enum_type": 0,
"for_loop": 0,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 7,
"memory_management": 2,
"memory_operation": 0,
"pointer_type": 2,
"return_statement": 5,
"struct_type": 1,
"switch_statement": 0,
"type_casting": 1,
"union_type": 0,
"while_loop": 2
} |
enscript-1.6.6#afm_prep#afm_error.c | enscript-1.6.6 | afm.c | afm_error | 5 | void
afm_error (AFMHandle handle, char *message)
{
fprintf (stderr, "AFM Error: %s\n", message);
}
| {
"array_type": 0,
"break_continue_statement": 0,
"enum_type": 0,
"for_loop": 0,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 0,
"memory_management": 0,
"memory_operation": 0,
"pointer_type": 0,
"return_statement": 0,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 0,
"union_type": 0,
"while_loop": 0
} |
tar-1.34#unlink_prep#queue_deferred_unlink.c | tar-1.34 | unlink.c | queue_deferred_unlink | 28 | void
queue_deferred_unlink (const char *name, _Bool is_dir)
{
struct deferred_unlink *p;
if (dunlink_head
&& records_written > dunlink_head->records_written + deferred_unlink_delay)
flush_deferred_unlinks (0);
p = dunlink_alloc ();
p->next = ((void *)0);
p->dir_idx = chdir_current;
p->file_name = xstrdup (name);
normalize_filename_x (p->file_name);
p->is_dir = is_dir;
p->records_written = records_written;
if (((p)->is_dir && ((p)->file_name[0] == 0 || strcmp ((p)->file_name, ".") == 0)))
{
struct deferred_unlink *q, *prev;
for (q = dunlink_head, prev = ((void *)0); q; prev = q, q = q->next)
if (((q)->is_dir && ((q)->file_name[0] == 0 || strcmp ((q)->file_name, ".") == 0)) && q->dir_idx < p->dir_idx)
break;
if (q)
dunlink_insert (prev, p);
else
dunlink_insert (dunlink_tail, p);
}
else
dunlink_insert (dunlink_tail, p);
}
| {
"array_type": 1,
"break_continue_statement": 1,
"enum_type": 0,
"for_loop": 1,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 4,
"memory_management": 0,
"memory_operation": 0,
"pointer_type": 3,
"return_statement": 0,
"struct_type": 2,
"switch_statement": 0,
"type_casting": 2,
"union_type": 0,
"while_loop": 0
} |
cflow-1.7#getopt_prep#rpl_getopt.c | cflow-1.7 | getopt.c | rpl_getopt | 1 | int rpl_getopt (int argc, char *const *argv, const char *optstring) { return rpl_getopt_internal (argc, (char **)argv, optstring, 0, 0, 0, 1); }
| {
"array_type": 0,
"break_continue_statement": 0,
"enum_type": 0,
"for_loop": 0,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 0,
"memory_management": 0,
"memory_operation": 0,
"pointer_type": 0,
"return_statement": 1,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 0,
"union_type": 0,
"while_loop": 0
} |
transcoder-set#NUMBER_SUBSEQUENCES_AB_STRING_REPEATED_K_TIMES_prep#min.c | transcoder-set | NUMBER_SUBSEQUENCES_AB_STRING_REPEATED_K_TIMES.c | min | 1 | int min(int x, int y) { return (x < y)? x: y; }
| {
"array_type": 0,
"break_continue_statement": 0,
"enum_type": 0,
"for_loop": 0,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 0,
"memory_management": 0,
"memory_operation": 0,
"pointer_type": 0,
"return_statement": 1,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 0,
"union_type": 0,
"while_loop": 0
} |
gprolog-1.5.0#wam2ma_prep#BT_String_List_Rec.c | gprolog-1.5.0 | wam2ma.c | BT_String_List_Rec | 9 | void
BT_String_List_Rec(BTNode *bt_node, BTStrLstFct fct)
{
if (bt_node == ((void *)0))
return;
BT_String_List_Rec(bt_node->left, fct);
(*fct) (bt_node->no, bt_node->str, (void *) bt_node->info);
BT_String_List_Rec(bt_node->right, fct);
}
| {
"array_type": 0,
"break_continue_statement": 0,
"enum_type": 0,
"for_loop": 0,
"function_pointer": 1,
"goto_statement": 0,
"if_statement": 1,
"memory_management": 0,
"memory_operation": 0,
"pointer_type": 0,
"return_statement": 1,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 2,
"union_type": 0,
"while_loop": 0
} |
transcoder-set#POSITION_ELEMENT_STABLE_SORT_prep#main.c | transcoder-set | POSITION_ELEMENT_STABLE_SORT.c | main | 26 | int main(void) {
int n_success = 0;
int param0_0[] = {4,8,9,12,15,16,18,28,28,31,33,36,36,37,40,41,44,44,46,50,50,50,52,52,54,55,60,61,65,68,71,75,75,78,81,84,87,89,90,92,94,97,97,98,98,99};
int param0_1[] = {-16,86,94,-86,-38,64,96,-64,94,10,-10,-62,-50,-46,-62,-32,-4,72,14,36,74,-66,46,82,-44,-22,-26,16,-8,0,-90,94,-50,22,-82,8,92,-84,-34,-36,-66};
int param0_2[] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1};
int param0_3[] = {66,8,30,84,36,96,45,63,23,23,14,34,86,51,18,97,21,39,96,70,28,96,78,68,88,66,13,24,74,94};
int param0_4[] = {-94,-90,-86,-86,-72,-72,-58,-50,-32,-22,-18,-10,-4,-2,-2,0,0,6,14,22,22,36,36,40,44,58,60,70,70,76,82,82,84,88,96};
int param0_5[] = {1,1,1,0,0,1,0,1,0,0,0,0,1,0,1,1,0,1,0,1,0,0,1,0,0,1,1,1,1,1,1,1,0,1,1,1,0,1,1};
int param0_6[] = {3,5,6,7,8,10,17,20,20,26,27,27,27,32,32,38,40,44,45,45,45,45,47,50,57,57,57,58,62,63,63,67,68,73,75,76,77,79,79,80,85,88,89,89,89,94,96,98};
int param0_7[] = {98,-92,18,-18,44,-88,-90,-66,-38,78,-22,-46,-20,64,-10,54};
int param0_8[] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1};
int param0_9[] = {14,17};
int *param0[10] = {param0_0,param0_1,param0_2,param0_3,param0_4,param0_5,param0_6,param0_7,param0_8,param0_9};
int param1[] = {37,31,30,26,17,30,42,14,19,1};
int param2[] = {32,27,34,21,31,36,35,12,31,1};
for(int i = 0; i < len(param0); ++i)
{
if(f_filled(param0[i],param1[i],param2[i]) == f_gold(param0[i],param1[i],param2[i]))
{
n_success+=1;
}
break;
}
printf("#Results:", " ", n_success, ", ", len(param0));
return 0;
}
| {
"array_type": 3,
"break_continue_statement": 1,
"enum_type": 0,
"for_loop": 1,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 1,
"memory_management": 0,
"memory_operation": 0,
"pointer_type": 1,
"return_statement": 1,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 1,
"union_type": 0,
"while_loop": 0
} |
json.h#test_prep#json_extract_get_array_size.c | json.h | test.c | json_extract_get_array_size | 17 | struct json_extract_result_s
json_extract_get_array_size(const struct json_array_s *const array) {
struct json_extract_result_s result;
size_t i;
const struct json_array_element_s *element = array->start;
result.dom_size = sizeof(struct json_array_s) +
(sizeof(struct json_array_element_s) * array->length);
result.data_size = 0;
for (i = 0; i < array->length; i++) {
const struct json_extract_result_s value_result =
json_extract_get_value_size(element->value);
result.dom_size += value_result.dom_size;
result.data_size += value_result.data_size;
element = element->next;
}
return result;
}
| {
"array_type": 0,
"break_continue_statement": 0,
"enum_type": 0,
"for_loop": 1,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 0,
"memory_management": 0,
"memory_operation": 0,
"pointer_type": 1,
"return_statement": 1,
"struct_type": 2,
"switch_statement": 0,
"type_casting": 2,
"union_type": 0,
"while_loop": 0
} |
xzoom#xzoom_prep#main.c | xzoom | xzoom.c | main | 375 | int
main(int argc, char **argv) {
XSetWindowAttributes xswa;
XEvent event;
XTextProperty str;
XSizeHints *sizeh = ((void *)0);
XClassHint *ch;
int buttonpressed = 0;
int visible = 0;
int scroll = 1;
char title[80];
XGCValues gcv;
char *dpyname = ((void *)0);
int source_geom_mask = 0x0000,
dest_geom_mask = 0x0000,
copy_from_src_mask;
int xpos = 0, ypos = 0;
int isdock = 0;
atexit(destroy_images);
progname = strrchr(argv[0], '/');
if(progname)
++progname;
else
progname = argv[0];
while(--argc > 0) {
++argv;
if(argv[0][0] == '=') {
dest_geom_mask = XParseGeometry(argv[0],
&xpos, &ypos,
&width[1], &height[1]);
continue;
}
if(!strcmp(argv[0], "-mag")) {
++argv; --argc;
magx = argc > 0 ? atoi(argv[0]) : -1;
if(magx <= 0)
Usage();
magy = argc > 1 ? atoi(argv[1]) : -1;
if(magy <= 0)
magy = magx;
else {
++argv; --argc;
}
continue;
}
if(!strcmp(argv[0], "-x")) {
flipx = 1;
continue;
}
if(!strcmp(argv[0], "-y")) {
flipy = 1;
continue;
}
if(!strcmp(argv[0], "-z") ||
!strcmp(argv[0], "-xy")) {
flipxy = 1;
continue;
}
if(!strcmp(argv[0], "-source")) {
++argv; --argc;
if(argc < 1)
Usage();
source_geom_mask = XParseGeometry(argv[0],
&xgrab, &ygrab,
&width[0], &height[0]);
continue;
}
if(!strcmp(argv[0], "-dest") ||
!strcmp(argv[0], "-geometry")) {
++argv; --argc;
if(argc < 1)
Usage();
dest_geom_mask = XParseGeometry(argv[0],
&xpos, &ypos,
&width[1], &height[1]);
continue;
}
if(!strcmp(argv[0], "-d") ||
!strcmp(argv[0], "-display")) {
++argv; --argc;
if(argc < 1)
Usage();
dpyname = argv[0];
continue;
}
if(!strcmp(argv[0], "-delay")) {
++argv; --argc;
if(argc < 1)
Usage();
if(sscanf(argv[0], "%u", &delay) != 1)
Usage();
delay *= 1000;
continue;
}
if(!strcmp(argv[0], "-dock")) {
isdock = 1;
continue;
}
Usage();
}
if (!(dpy = XOpenDisplay(dpyname))) {
perror("Cannot open display");
exit(-1);
}
copy_from_src_mask = 0x0000;
if(source_geom_mask & 0x0004) {
if(flipxy) {
height[1] = magy * width[0];
copy_from_src_mask |= 0x0008;
}
else {
width[1] = magx * width[0];
copy_from_src_mask |= 0x0004;
}
}
if(source_geom_mask & 0x0008) {
if(flipxy) {
width[1] = magx * height[0];
copy_from_src_mask |= 0x0004;
}
else {
height[1] = magy * height[0];
copy_from_src_mask |= 0x0008;
}
}
if(copy_from_src_mask & dest_geom_mask) {
fprintf(stderr, "Conflicting dimensions between source and dest geometry\n");
Usage();
}
scr = (&((_XPrivDisplay)(dpy))->screens[(((_XPrivDisplay)(dpy))->default_screen)]);
depth = ((scr)->root_depth);
if (depth < 8) {
fprintf(stderr, "%s: need at least 8 bits/pixel\n", progname);
exit(1);
}
if(source_geom_mask & 0x0010)
xgrab += ((scr)->width);
if(source_geom_mask & 0x0020)
ygrab += ((scr)->height);
if(dest_geom_mask & 0x0010)
xpos += ((scr)->width);
if(dest_geom_mask & 0x0020)
ypos += ((scr)->height);
printf("=%dx%d+%d+%d\n", width[1], height[1], xpos, ypos);
xswa.event_mask = (1L<<2)|(1L<<3)|(1L<<13);
xswa.event_mask |= (1L<<17);
xswa.event_mask |= (1L<<0)|(1L<<1);
xswa.event_mask |= (1L<<16);
xswa.background_pixel = ((scr)->black_pixel);
win = XCreateWindow(dpy, ((scr)->root),
xpos, ypos, width[1], height[1], 0,
((scr)->root_depth), 1,
((scr)->root_visual),
(1L<<11) | (1L<<1), &xswa);
XChangeProperty(dpy, win, ((Atom) 37), ((Atom) 31), 8,
0,
(unsigned char *)progname, strlen(progname));
if(!isdock) {
sizeh = XAllocSizeHints();
sizeh->flags = (1L << 5) | (1L << 4);
sizeh->min_width = sizeh->max_width = width[1];
sizeh->min_height = sizeh->max_height = height[1];
}
XStringListToTextProperty(&progname, 1, &str);
ch = XAllocClassHint();
ch->res_class = progname;
ch->res_name = progname;
XSetWMProperties(dpy, win, &str, &str, ((void *)0), 0, sizeh, ((void *)0), ch);
if(isdock) {
wm_windowtype = XInternAtom(dpy, "_NET_WM_WINDOW_TYPE", 0);
wm_dock = XInternAtom(dpy, "_NET_WM_WINDOW_TYPE_DOCK", 0);
XChangeProperty(dpy, win, wm_windowtype, ((Atom) 4), 32,
0, (unsigned char *)&wm_dock,
1);
}
wm_delete_window = XInternAtom (dpy, "WM_DELETE_WINDOW", 0);
wm_protocols = XInternAtom(dpy, "WM_PROTOCOLS", 0);
status = XSetWMProtocols(dpy, win, &wm_delete_window, 1);
set_title = 1;
status = XMapWindow(dpy, win);
gcv.plane_mask = ((unsigned long)~0L);
gcv.subwindow_mode = 1;
gcv.function = 0x3;
gcv.foreground = ((scr)->white_pixel);
gcv.background = ((scr)->black_pixel);
gc = XCreateGC(dpy, ((scr)->root),
(1L<<0)|(1L<<1)|(1L<<15)|(1L<<2)|(1L<<3),
&gcv);
resize(width[1], height[1]);
when_button = XCreateFontCursor(dpy, 144);
crosshair = XCreateFontCursor(dpy, 34);
XDefineCursor(dpy, win, crosshair);
for(;;) {
while(XPending(dpy)) {
XNextEvent(dpy, &event);
switch(event.type) {
case 33:
if ((event.xclient.message_type == wm_protocols) &&
(event.xclient.data.l[0] == wm_delete_window)) {
exit(0);
}
break;
case 22:
if(event.xconfigure.width != width[1] ||
event.xconfigure.height != height[1]) {
resize(event.xconfigure.width, event.xconfigure.height);
}
break;
case 21:
break;
case 15:
visible = (event.xvisibility.state!=2);
break;
case 3:
switch(XKeycodeToKeysym(dpy, event.xkey.keycode, 0)) {
case 0xffe3:
case 0xffe4:
scroll = 1;
break;
}
break;
case 2:
switch(XKeycodeToKeysym(dpy, event.xkey.keycode, 0)) {
case 0xffe3:
case 0xffe4:
scroll = 10;
break;
case '+':
case '=':
case 0xffab:
if(!yzoom_flag) ++magx;
if(!xzoom_flag) ++magy;
xzoom_flag = yzoom_flag = 0;
resize(width[1], height[1]);
set_title = 1;
break;
case '-':
case 0xffad:
if(!yzoom_flag) --magx;
if(!xzoom_flag) --magy;
xzoom_flag = yzoom_flag = 0;
if(magx < 1) magx = 1;
if(magy < 1) magy = 1;
resize(width[1], height[1]);
set_title = 1;
break;
case 0xff51:
case 0xff96:
if(flipxy)
if(flipx)
ygrab += scroll;
else
ygrab -= scroll;
else
if(flipx)
xgrab += scroll;
else
xgrab -= scroll;
break;
case 0xff53:
case 0xff98:
if(flipxy)
if(flipx)
ygrab -= scroll;
else
ygrab += scroll;
else
if(flipx)
xgrab -= scroll;
else
xgrab += scroll;
break;
case 0xff52:
case 0xff97:
if(flipxy)
if(flipy)
xgrab -= scroll;
else
xgrab += scroll;
else
if(flipy)
ygrab += scroll;
else
ygrab -= scroll;
break;
case 0xff54:
case 0xff99:
if(flipxy)
if(flipy)
xgrab += scroll;
else
xgrab -= scroll;
else
if(flipy)
ygrab -= scroll;
else
ygrab += scroll;
break;
case 'x':
flipx = !flipx;
set_title = 1;
break;
case 'y':
flipy = !flipy;
set_title = 1;
break;
case 'z':
if(flipx^flipy^flipxy) {
flipx = !flipx;
flipy = !flipy;
}
flipxy = !flipxy;
resize(width[1], height[1]);
set_title = 1;
break;
case 'w':
xzoom_flag = 1;
yzoom_flag = 0;
break;
case 'h':
yzoom_flag = 1;
xzoom_flag = 0;
break;
case 'g':
gridx = !gridx;
gridy = !gridy;
break;
case 'd':
if(++delay_index >= 5)
delay_index = 0;
delay = delays[delay_index];
sprintf(title, "delay = %d ms", delay/1000);
XChangeProperty(dpy, win, ((Atom) 39), ((Atom) 31), 8,
0,
(unsigned char *)title, strlen(title));
signal(14, timeout_func);
alarm(2);
break;
case 'q':
exit(0);
break;
}
break;
case 4:
xgrab = event.xbutton.x_root;
ygrab = event.xbutton.y_root;
XDefineCursor(dpy, win, when_button);
buttonpressed = 1;
break;
case 5:
XDefineCursor(dpy, win, crosshair);
buttonpressed = 0;
break;
case 6:
if(buttonpressed) {
xgrab = event.xmotion.x_root;
ygrab = event.xmotion.y_root;
}
break;
}
if(xgrab < 0)
xgrab = 0;
if(xgrab > ((scr)->width)-width[0])
xgrab = ((scr)->width)-width[0];
if(ygrab < 0)
ygrab = 0;
if(ygrab > ((scr)->height)-height[0])
ygrab = ((scr)->height)-height[0];
}
if(visible)
xzoom(buttonpressed);
if(!buttonpressed && delay > 0)
usleep(delay);
}
}
| {
"array_type": 6,
"break_continue_statement": 35,
"enum_type": 0,
"for_loop": 1,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 60,
"memory_management": 0,
"memory_operation": 0,
"pointer_type": 3,
"return_statement": 0,
"struct_type": 0,
"switch_statement": 3,
"type_casting": 3,
"union_type": 0,
"while_loop": 2
} |
transcoder-set#PYTHON_PROGRAM_FIND_PERIMETER_CIRCUMFERENCE_SQUARE_RECTANGLE_prep#main.c | transcoder-set | PYTHON_PROGRAM_FIND_PERIMETER_CIRCUMFERENCE_SQUARE_RECTANGLE.c | main | 14 | int main(void) {
int n_success = 0;
int param0[] = {98,9,18,38,84,8,39,6,60,47};
for(int i = 0; i < len(param0); ++i)
{
if(f_filled(param0[i]) == f_gold(param0[i]))
{
n_success+=1;
}
break;
}
printf("#Results:", " ", n_success, ", ", len(param0));
return 0;
}
| {
"array_type": 1,
"break_continue_statement": 1,
"enum_type": 0,
"for_loop": 1,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 1,
"memory_management": 0,
"memory_operation": 0,
"pointer_type": 0,
"return_statement": 1,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 1,
"union_type": 0,
"while_loop": 0
} |
patch-2.7.6#hash_prep#hash_get_max_bucket_length.c | patch-2.7.6 | hash.c | hash_get_max_bucket_length | 19 | size_t
hash_get_max_bucket_length (const Hash_table *table)
{
struct hash_entry const *bucket;
size_t max_bucket_length = 0;
for (bucket = table->bucket; bucket < table->bucket_limit; bucket++)
{
if (bucket->data)
{
struct hash_entry const *cursor = bucket;
size_t bucket_length = 1;
while (cursor = cursor->next, cursor)
bucket_length++;
if (bucket_length > max_bucket_length)
max_bucket_length = bucket_length;
}
}
return max_bucket_length;
}
| {
"array_type": 0,
"break_continue_statement": 0,
"enum_type": 0,
"for_loop": 1,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 2,
"memory_management": 0,
"memory_operation": 0,
"pointer_type": 2,
"return_statement": 1,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 0,
"union_type": 0,
"while_loop": 1
} |
screen-4.9.0#socket_prep#ReceiveRaw.c | screen-4.9.0 | socket.c | ReceiveRaw | 31 | void
ReceiveRaw(s)
int s;
{
char rd[256];
int len = 0;
struct sockaddr_un a;
_Bool is_socket;
is_socket = IsSocket(SockPath);
if (!is_socket)
{
if (fcntl(s, 4, 0) < 0)
Panic((*__errno_location ()), "BLOCK fcntl");
}
else
{
len = sizeof(a);
s = accept(s, (struct sockaddr *)&a, (void *)&len);
if (s < 0)
{
Msg((*__errno_location ()), "accept");
return;
}
}
while ((len = read(s, rd, 255)) > 0)
{
rd[len] = 0;
printf("%s", rd);
}
close(s);
}
| {
"array_type": 1,
"break_continue_statement": 0,
"enum_type": 0,
"for_loop": 0,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 3,
"memory_management": 0,
"memory_operation": 0,
"pointer_type": 0,
"return_statement": 1,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 1,
"union_type": 0,
"while_loop": 1
} |
gprolog-1.5.0#stream_c_prep#Pl_Add_Stream_Mirror_2.c | gprolog-1.5.0 | stream_c.c | Pl_Add_Stream_Mirror_2 | 9 | void
Pl_Add_Stream_Mirror_2(WamWord sora_word, WamWord mirror_word)
{
int stm;
int m_stm;
stm = Pl_Get_Stream_Or_Alias(sora_word, 1);
m_stm = Pl_Get_Stream_Or_Alias(mirror_word, 3);
Pl_Add_Mirror_To_Stream(stm, m_stm);
}
| {
"array_type": 0,
"break_continue_statement": 0,
"enum_type": 0,
"for_loop": 0,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 0,
"memory_management": 0,
"memory_operation": 0,
"pointer_type": 0,
"return_statement": 0,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 0,
"union_type": 0,
"while_loop": 0
} |
screen-4.9.0#screen_prep#Hangup.c | screen-4.9.0 | screen.c | Hangup | 14 | void Hangup()
{
if (display == 0)
return;
do {} while (0);
if (display->d_userfd >= 0) {
close(display->d_userfd);
display->d_userfd = -1;
}
if (auto_detach || displays->d_next)
Detach(6);
else
Finit(0);
}
| {
"array_type": 0,
"break_continue_statement": 0,
"enum_type": 0,
"for_loop": 0,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 3,
"memory_management": 0,
"memory_operation": 0,
"pointer_type": 0,
"return_statement": 1,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 0,
"union_type": 0,
"while_loop": 1
} |
transcoder-set#FIND_PERIMETER_CYLINDER_prep#max.c | transcoder-set | FIND_PERIMETER_CYLINDER.c | max | 1 | int max(int x, int y) { return (x > y)? x: y; }
| {
"array_type": 0,
"break_continue_statement": 0,
"enum_type": 0,
"for_loop": 0,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 0,
"memory_management": 0,
"memory_operation": 0,
"pointer_type": 0,
"return_statement": 1,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 0,
"union_type": 0,
"while_loop": 0
} |
tinycc#tccrun_prep#tcc_run.c | tinycc | tccrun.c | tcc_run | 38 | int tcc_run(TCCState *s1, int argc, char **argv)
{
int (*prog_main)(int, char **);
s1->runtime_main = "main";
if ((s1->dflag & 16) && !find_elf_sym(s1->symtab, s1->runtime_main))
return 0;
if (tcc_relocate(s1, (void*)1) < 0)
return -1;
prog_main = tcc_get_symbol_err(s1, s1->runtime_main);
if (s1->do_debug) {
set_exception_handler();
tcc_set_rt_prog_main(prog_main);
}
(*__errno_location ()) = 0;
if (s1->do_bounds_check) {
void (*bound_init)(void);
void (*bound_exit)(void);
void (*bound_new_region)(void *p, Elf64_Addr size);
int (*bound_delete_region)(void *p);
int i, ret;
rt_bound_error_msg = tcc_get_symbol_err(s1, "__bound_error_msg");
bound_init = tcc_get_symbol_err(s1, "__bound_init");
bound_exit = tcc_get_symbol_err(s1, "__bound_exit");
bound_new_region = tcc_get_symbol_err(s1, "__bound_new_region");
bound_delete_region = tcc_get_symbol_err(s1, "__bound_delete_region");
bound_init();
bound_new_region(argv, argc*sizeof(argv[0]));
for (i=0; i<argc; ++i)
bound_new_region(argv[i], strlen(argv[i]) + 1);
ret = (*prog_main)(argc, argv);
for (i=0; i<argc; ++i)
bound_delete_region(argv[i]);
bound_delete_region(argv);
bound_exit();
return ret;
}
return (*prog_main)(argc, argv);
}
| {
"array_type": 1,
"break_continue_statement": 0,
"enum_type": 0,
"for_loop": 2,
"function_pointer": 7,
"goto_statement": 0,
"if_statement": 4,
"memory_management": 0,
"memory_operation": 0,
"pointer_type": 5,
"return_statement": 4,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 3,
"union_type": 0,
"while_loop": 0
} |
tmux#paste_prep#paste_buffer_name.c | tmux | paste.c | paste_buffer_name | 5 | const char *
paste_buffer_name(struct paste_buffer *pb)
{
return (pb->name);
}
| {
"array_type": 0,
"break_continue_statement": 0,
"enum_type": 0,
"for_loop": 0,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 0,
"memory_management": 0,
"memory_operation": 0,
"pointer_type": 0,
"return_statement": 1,
"struct_type": 1,
"switch_statement": 0,
"type_casting": 0,
"union_type": 0,
"while_loop": 0
} |
libcsv#libcsv_prep#csv_strerror.c | libcsv | libcsv.c | csv_strerror | 8 | const char *
csv_strerror(int status)
{
if (status >= 4 || status < 0)
return csv_errors[4];
else
return csv_errors[status];
}
| {
"array_type": 1,
"break_continue_statement": 0,
"enum_type": 0,
"for_loop": 0,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 1,
"memory_management": 0,
"memory_operation": 0,
"pointer_type": 0,
"return_statement": 2,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 0,
"union_type": 0,
"while_loop": 0
} |
libosip2-5.3.1#osip_contact_prep#osip_contact_to_str.c | libosip2-5.3.1 | osip_contact.c | osip_contact_to_str | 13 | int osip_contact_to_str(const osip_contact_t *contact, char **dest) {
if (contact == ((void *)0))
return -2;
if (contact->displayname != ((void *)0)) {
if (strncmp(contact->displayname, "*", 1) == 0) {
*dest = osip_strdup("*");
if (*dest == ((void *)0))
return -4;
return 0;
}
}
return osip_from_to_str((osip_from_t *) contact, dest);
}
| {
"array_type": 0,
"break_continue_statement": 0,
"enum_type": 0,
"for_loop": 0,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 4,
"memory_management": 0,
"memory_operation": 0,
"pointer_type": 0,
"return_statement": 4,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 3,
"union_type": 0,
"while_loop": 0
} |
libxml2#xmlstring_prep#xmlEscapeFormatString.c | libxml2 | xmlstring.c | xmlEscapeFormatString | 37 | xmlChar *
xmlEscapeFormatString(xmlChar **msg)
{
xmlChar *msgPtr = ((void *)0);
xmlChar *result = ((void *)0);
xmlChar *resultPtr = ((void *)0);
size_t count = 0;
size_t msgLen = 0;
size_t resultLen = 0;
if (!msg || !*msg)
return(((void *)0));
for (msgPtr = *msg; *msgPtr != '\0'; ++msgPtr) {
++msgLen;
if (*msgPtr == '%')
++count;
}
if (count == 0)
return(*msg);
if ((count > 0x7fffffff) || (msgLen > 0x7fffffff - count))
return(((void *)0));
resultLen = msgLen + count + 1;
result = xmlMalloc(resultLen);
if (result == ((void *)0)) {
xmlFree(*msg);
*msg = ((void *)0);
return(((void *)0));
}
for (msgPtr = *msg, resultPtr = result; *msgPtr != '\0'; ++msgPtr, ++resultPtr) {
*resultPtr = *msgPtr;
if (*msgPtr == '%')
*(++resultPtr) = '%';
}
result[resultLen - 1] = '\0';
xmlFree(*msg);
*msg = result;
return *msg;
}
| {
"array_type": 0,
"break_continue_statement": 0,
"enum_type": 0,
"for_loop": 2,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 6,
"memory_management": 0,
"memory_operation": 0,
"pointer_type": 3,
"return_statement": 5,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 8,
"union_type": 0,
"while_loop": 0
} |
libxml2#testapi_prep#main.c | libxml2 | testapi.c | main | 34 | int main(int argc, char **argv) {
int ret;
int blocks, mem;
memset(chartab, 0, sizeof(chartab));
strncpy((char *) chartab, " chartab\n", 20);
memset(inttab, 0, sizeof(inttab));
memset(longtab, 0, sizeof(longtab));
xmlInitParser();
xmlInitializeCatalog();
xmlRelaxNGInitTypes();
xmlCheckVersion(21400);
xmlSetStructuredErrorFunc(((void *)0), structured_errors);
xmlSetExternalEntityLoader(xmlNoNetExternalEntityLoader);
if (argc >= 2) {
if (!strcmp(argv[1], "-q")) {
quiet = 1;
if (argc >= 3)
ret = test_module(argv[2]);
else
ret = testlibxml2();
} else {
ret = test_module(argv[1]);
}
} else
ret = testlibxml2();
xmlCleanupParser();
blocks = xmlMemBlocks();
mem = xmlMemUsed();
if ((blocks != 0) || (mem != 0)) {
printf("testapi leaked %d bytes in %d blocks\n", mem, blocks);
ret = 1;
}
return (ret != 0);
}
| {
"array_type": 1,
"break_continue_statement": 0,
"enum_type": 0,
"for_loop": 0,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 4,
"memory_management": 0,
"memory_operation": 3,
"pointer_type": 0,
"return_statement": 1,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 2,
"union_type": 0,
"while_loop": 0
} |
transcoder-set#SUBSET_SUM_DIVISIBLE_M_prep#max.c | transcoder-set | SUBSET_SUM_DIVISIBLE_M.c | max | 1 | int max(int x, int y) { return (x > y)? x: y; }
| {
"array_type": 0,
"break_continue_statement": 0,
"enum_type": 0,
"for_loop": 0,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 0,
"memory_management": 0,
"memory_operation": 0,
"pointer_type": 0,
"return_statement": 1,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 0,
"union_type": 0,
"while_loop": 0
} |
transcoder-set#CHECK_LARGE_NUMBER_DIVISIBLE_9_NOT_prep#f_gold.c | transcoder-set | CHECK_LARGE_NUMBER_DIVISIBLE_9_NOT.c | f_gold | 8 | int f_gold ( char str [] ) {
int n = strlen(str);
int digitSum = 0;
for ( int i = 0;
i < n;
i ++ ) digitSum += ( str [ i ] - '0' );
return ( digitSum % 9 == 0 );
}
| {
"array_type": 1,
"break_continue_statement": 0,
"enum_type": 0,
"for_loop": 1,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 0,
"memory_management": 0,
"memory_operation": 0,
"pointer_type": 0,
"return_statement": 1,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 0,
"union_type": 0,
"while_loop": 0
} |
libxml2#xmlstring_prep#xmlUTF8Size.c | libxml2 | xmlstring.c | xmlUTF8Size | 18 | int
xmlUTF8Size(const xmlChar *utf) {
xmlChar mask;
int len;
if (utf == ((void *)0))
return -1;
if (*utf < 0x80)
return 1;
if (!(*utf & 0x40))
return -1;
len = 2;
for (mask=0x20; mask != 0; mask>>=1) {
if (!(*utf & mask))
return len;
len++;
}
return -1;
}
| {
"array_type": 0,
"break_continue_statement": 0,
"enum_type": 0,
"for_loop": 1,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 4,
"memory_management": 0,
"memory_operation": 0,
"pointer_type": 0,
"return_statement": 5,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 1,
"union_type": 0,
"while_loop": 0
} |
diffutils-3.10#util_prep#translate_range.c | diffutils-3.10 | util.c | translate_range | 8 | void
translate_range (struct file_data const *file,
lin a, lin b,
lin *aptr, lin *bptr)
{
*aptr = translate_line_number (file, a - 1) + 1;
*bptr = translate_line_number (file, b + 1) - 1;
}
| {
"array_type": 0,
"break_continue_statement": 0,
"enum_type": 0,
"for_loop": 0,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 0,
"memory_management": 0,
"memory_operation": 0,
"pointer_type": 0,
"return_statement": 0,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 0,
"union_type": 0,
"while_loop": 0
} |
transcoder-set#CHECK_REVERSING_SUB_ARRAY_MAKE_ARRAY_SORTED_1_prep#sort.c | transcoder-set | CHECK_REVERSING_SUB_ARRAY_MAKE_ARRAY_SORTED_1.c | sort | 1 | void sort (int arr [ ], int n) {qsort (arr, n, sizeof(int), cmpfunc);}
| {
"array_type": 0,
"break_continue_statement": 0,
"enum_type": 0,
"for_loop": 0,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 0,
"memory_management": 0,
"memory_operation": 0,
"pointer_type": 0,
"return_statement": 0,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 1,
"union_type": 0,
"while_loop": 0
} |
libosip2-5.3.1#port_sema_prep#osip_sem_destroy.c | libosip2-5.3.1 | port_sema.c | osip_sem_destroy | 8 | int osip_sem_destroy(struct osip_sem *_sem) {
osip_sem_t *sem = (osip_sem_t *) _sem;
if (sem == ((void *)0))
return 0;
sem_destroy(sem);
{ if (sem != ((void *)0)) { if (osip_free_func) osip_free_func(sem); else free(sem); } };
return 0;
}
| {
"array_type": 0,
"break_continue_statement": 0,
"enum_type": 0,
"for_loop": 0,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 2,
"memory_management": 1,
"memory_operation": 0,
"pointer_type": 1,
"return_statement": 2,
"struct_type": 1,
"switch_statement": 0,
"type_casting": 2,
"union_type": 0,
"while_loop": 0
} |
libxml2#libxml2-py_prep#libxml_xmlParseChunk.c | libxml2 | libxml2-py.c | libxml_xmlParseChunk | 17 | PyObject *
libxml_xmlParseChunk(PyObject *self __attribute__ ((__unused__)), PyObject *args) {
PyObject *py_retval;
int c_retval;
xmlParserCtxtPtr ctxt;
PyObject *pyobj_ctxt;
char * chunk;
Py_ssize_t py_buffsize0;
int size;
int terminate;
if (!_PyArg_ParseTuple_SizeT(args, (char *)"Os#ii:xmlParseChunk", &pyobj_ctxt, &chunk, &py_buffsize0, &size, &terminate))
return(((void *)0));
ctxt = (xmlParserCtxtPtr) (((pyobj_ctxt) == (&_Py_NoneStruct)) ? ((void *)0) : (((PyparserCtxt_Object *)(pyobj_ctxt))->obj));
c_retval = xmlParseChunk(ctxt, chunk, size, terminate);
py_retval = libxml_intWrap((int) c_retval);
return(py_retval);
}
| {
"array_type": 0,
"break_continue_statement": 0,
"enum_type": 0,
"for_loop": 0,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 1,
"memory_management": 0,
"memory_operation": 0,
"pointer_type": 2,
"return_statement": 2,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 4,
"union_type": 0,
"while_loop": 0
} |
transcoder-set#SUM_PAIRWISE_PRODUCTS_1_prep#len.c | transcoder-set | SUM_PAIRWISE_PRODUCTS_1.c | len | 1 | int len (int arr [ ]) {return ((int) (sizeof (arr) / sizeof (arr)[0]));}
| {
"array_type": 0,
"break_continue_statement": 0,
"enum_type": 0,
"for_loop": 0,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 0,
"memory_management": 0,
"memory_operation": 0,
"pointer_type": 0,
"return_statement": 1,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 1,
"union_type": 0,
"while_loop": 0
} |
which-2.21#bash_prep#file_status.c | which-2.21 | bash.c | file_status | 16 | int
file_status (char const* name)
{
struct stat finfo;
int r;
if (stat (name, &finfo) < 0)
return (0);
if (((((finfo.st_mode)) & 0170000) == (0040000)))
return (0x1|0x10);
r = 0x1;
if (eaccess (name, 1) == 0)
r |= 0x2;
if (eaccess (name, 4) == 0)
r |= 0x40;
return r;
}
| {
"array_type": 0,
"break_continue_statement": 0,
"enum_type": 0,
"for_loop": 0,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 4,
"memory_management": 0,
"memory_operation": 0,
"pointer_type": 0,
"return_statement": 3,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 0,
"union_type": 0,
"while_loop": 0
} |
uucp-1.07#trans_prep#fqueue_local.c | uucp-1.07 | trans.c | fqueue_local | 9 | boolean
fqueue_local (qdaemon, qtrans)
struct sdaemon *qdaemon __attribute__ ((__unused__));
struct stransfer *qtrans;
{
utdequeue (qtrans);
utqueue (&qTlocal, qtrans, (0));
return (1);
}
| {
"array_type": 0,
"break_continue_statement": 0,
"enum_type": 0,
"for_loop": 0,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 0,
"memory_management": 0,
"memory_operation": 0,
"pointer_type": 0,
"return_statement": 1,
"struct_type": 2,
"switch_statement": 0,
"type_casting": 0,
"union_type": 0,
"while_loop": 0
} |
transcoder-set#SEARCH_AN_ELEMENT_IN_AN_ARRAY_WHERE_DIFFERENCE_BETWEEN_ADJACENT_ELEMENTS_IS_1_prep#f_gold.c | transcoder-set | SEARCH_AN_ELEMENT_IN_AN_ARRAY_WHERE_DIFFERENCE_BETWEEN_ADJACENT_ELEMENTS_IS_1.c | f_gold | 9 | int f_gold ( int arr [ ], int n, int x ) {
int i = 0;
while ( i < n ) {
if ( arr [ i ] == x ) return i;
i = i + abs ( arr [ i ] - x );
}
printf("number is not present!");
return - 1;
}
| {
"array_type": 1,
"break_continue_statement": 0,
"enum_type": 0,
"for_loop": 0,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 1,
"memory_management": 0,
"memory_operation": 0,
"pointer_type": 0,
"return_statement": 2,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 0,
"union_type": 0,
"while_loop": 1
} |
nettle-3.9.1#sexp2dsa_prep#nettle_dsa_sha256_keypair_from_sexp.c | nettle-3.9.1 | sexp2dsa.c | nettle_dsa_sha256_keypair_from_sexp | 14 | int
nettle_dsa_sha256_keypair_from_sexp(struct dsa_params *params,
mpz_t pub,
mpz_t priv,
unsigned p_max_bits,
size_t length, const uint8_t *expr)
{
struct sexp_iterator i;
return nettle_sexp_iterator_first(&i, length, expr)
&& nettle_sexp_iterator_check_type(&i, priv ? "private-key" : "public-key")
&& nettle_sexp_iterator_check_type(&i, "dsa-sha256")
&& nettle_dsa_keypair_from_sexp_alist(params, pub, priv,
p_max_bits, 256, &i);
}
| {
"array_type": 0,
"break_continue_statement": 0,
"enum_type": 0,
"for_loop": 0,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 0,
"memory_management": 0,
"memory_operation": 0,
"pointer_type": 0,
"return_statement": 1,
"struct_type": 1,
"switch_statement": 0,
"type_casting": 0,
"union_type": 0,
"while_loop": 0
} |
transcoder-set#DICE_THROW_PROBLEM_prep#main.c | transcoder-set | DICE_THROW_PROBLEM.c | main | 16 | int main(void) {
int n_success = 0;
int param0[] = {94,7,20,90,50,32,46,82,43,6};
int param1[] = {4,12,44,94,58,90,25,50,82,83};
int param2[] = {69,33,24,88,27,29,6,87,70,19};
for(int i = 0; i < len(param0); ++i)
{
if(f_filled(param0[i],param1[i],param2[i]) == f_gold(param0[i],param1[i],param2[i]))
{
n_success+=1;
}
break;
}
printf("#Results:", " ", n_success, ", ", len(param0));
return 0;
}
| {
"array_type": 3,
"break_continue_statement": 1,
"enum_type": 0,
"for_loop": 1,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 1,
"memory_management": 0,
"memory_operation": 0,
"pointer_type": 0,
"return_statement": 1,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 1,
"union_type": 0,
"while_loop": 0
} |
transcoder-set#SUM_SERIES_ALTERNATE_SIGNED_SQUARES_AP_prep#f_filled.c | transcoder-set | SUM_SERIES_ALTERNATE_SIGNED_SQUARES_AP.c | f_filled | 1 | int f_filled ( int n, int a [ ] ) {}
| {
"array_type": 0,
"break_continue_statement": 0,
"enum_type": 0,
"for_loop": 0,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 0,
"memory_management": 0,
"memory_operation": 0,
"pointer_type": 0,
"return_statement": 0,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 0,
"union_type": 0,
"while_loop": 0
} |
libxml2#xmlreader_prep#xmlTextReaderIsNamespaceDecl.c | libxml2 | xmlreader.c | xmlTextReaderIsNamespaceDecl | 16 | int
xmlTextReaderIsNamespaceDecl(xmlTextReaderPtr reader) {
xmlNodePtr node;
if (reader == ((void *)0))
return(-1);
if (reader->node == ((void *)0))
return(-1);
if (reader->curnode != ((void *)0))
node = reader->curnode;
else
node = reader->node;
if (XML_NAMESPACE_DECL == node->type)
return(1);
else
return(0);
}
| {
"array_type": 0,
"break_continue_statement": 0,
"enum_type": 0,
"for_loop": 0,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 4,
"memory_management": 0,
"memory_operation": 0,
"pointer_type": 0,
"return_statement": 4,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 3,
"union_type": 0,
"while_loop": 0
} |
json.h#allow_no_commas_prep#json_write_pretty_value.c | json.h | allow_no_commas.c | json_write_pretty_value | 37 | char *json_write_pretty_value(const struct json_value_s *value, size_t depth,
const char *indent, const char *newline,
char *data) {
switch (value->type) {
default:
return 0;
case json_type_number:
return json_write_number((struct json_number_s *)value->payload, data);
case json_type_string:
return json_write_string((struct json_string_s *)value->payload, data);
case json_type_array:
return json_write_pretty_array((struct json_array_s *)value->payload, depth,
indent, newline, data);
case json_type_object:
return json_write_pretty_object((struct json_object_s *)value->payload,
depth, indent, newline, data);
case json_type_true:
data[0] = 't';
data[1] = 'r';
data[2] = 'u';
data[3] = 'e';
return data + 4;
case json_type_false:
data[0] = 'f';
data[1] = 'a';
data[2] = 'l';
data[3] = 's';
data[4] = 'e';
return data + 5;
case json_type_null:
data[0] = 'n';
data[1] = 'u';
data[2] = 'l';
data[3] = 'l';
return data + 4;
}
}
| {
"array_type": 1,
"break_continue_statement": 0,
"enum_type": 0,
"for_loop": 0,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 0,
"memory_management": 0,
"memory_operation": 0,
"pointer_type": 0,
"return_statement": 8,
"struct_type": 1,
"switch_statement": 1,
"type_casting": 4,
"union_type": 0,
"while_loop": 0
} |
tinycc#tccgen_prep#put_extern_sym.c | tinycc | tccgen.c | put_extern_sym | 6 | void put_extern_sym(Sym *sym, Section *section,
Elf64_Addr value, unsigned long size)
{
int sh_num = section ? section->sh_num : 0;
put_extern_sym2(sym, sh_num, value, size, 1);
}
| {
"array_type": 0,
"break_continue_statement": 0,
"enum_type": 0,
"for_loop": 0,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 0,
"memory_management": 0,
"memory_operation": 0,
"pointer_type": 0,
"return_statement": 0,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 0,
"union_type": 0,
"while_loop": 0
} |
transcoder-set#CONVERTING_ONE_STRING_USING_APPEND_DELETE_LAST_OPERATIONS_prep#min.c | transcoder-set | CONVERTING_ONE_STRING_USING_APPEND_DELETE_LAST_OPERATIONS.c | min | 1 | int min(int x, int y) { return (x < y)? x: y; }
| {
"array_type": 0,
"break_continue_statement": 0,
"enum_type": 0,
"for_loop": 0,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 0,
"memory_management": 0,
"memory_operation": 0,
"pointer_type": 0,
"return_statement": 1,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 0,
"union_type": 0,
"while_loop": 0
} |
tmux#key-bindings_prep#key_bindings_RB_INSERT.c | tmux | key-bindings.c | key_bindings_RB_INSERT | 1 | struct key_binding * key_bindings_RB_INSERT(struct key_bindings *head, struct key_binding *elm) { struct key_binding *tmp; struct key_binding *parent = ((void *)0); int comp = 0; tmp = (head)->rbh_root; while (tmp) { parent = tmp; comp = (key_bindings_cmp)(elm, parent); if (comp < 0) tmp = (tmp)->entry.rbe_left; else if (comp > 0) tmp = (tmp)->entry.rbe_right; else return (tmp); } do { (elm)->entry.rbe_parent = parent; (elm)->entry.rbe_left = (elm)->entry.rbe_right = ((void *)0); (elm)->entry.rbe_color = 1; } while (0); if (parent != ((void *)0)) { if (comp < 0) (parent)->entry.rbe_left = elm; else (parent)->entry.rbe_right = elm; do {} while (0); } else (head)->rbh_root = elm; key_bindings_RB_INSERT_COLOR(head, elm); return (((void *)0)); }
| {
"array_type": 0,
"break_continue_statement": 0,
"enum_type": 0,
"for_loop": 0,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 1,
"memory_management": 0,
"memory_operation": 0,
"pointer_type": 2,
"return_statement": 1,
"struct_type": 1,
"switch_statement": 0,
"type_casting": 1,
"union_type": 0,
"while_loop": 1
} |
libxml2#libxml2-py_prep#libxml_xmlDocSetRootElement.c | libxml2 | libxml2-py.c | libxml_xmlDocSetRootElement | 16 | PyObject *
libxml_xmlDocSetRootElement(PyObject *self __attribute__ ((__unused__)), PyObject *args) {
PyObject *py_retval;
xmlNodePtr c_retval;
xmlDocPtr doc;
PyObject *pyobj_doc;
xmlNodePtr root;
PyObject *pyobj_root;
if (!_PyArg_ParseTuple_SizeT(args, (char *)"OO:xmlDocSetRootElement", &pyobj_doc, &pyobj_root))
return(((void *)0));
doc = (xmlDocPtr) (((pyobj_doc) == (&_Py_NoneStruct)) ? ((void *)0) : (((PyxmlNode_Object *)(pyobj_doc))->obj));
root = (xmlNodePtr) (((pyobj_root) == (&_Py_NoneStruct)) ? ((void *)0) : (((PyxmlNode_Object *)(pyobj_root))->obj));
c_retval = xmlDocSetRootElement(doc, root);
py_retval = libxml_xmlNodePtrWrap((xmlNodePtr) c_retval);
return(py_retval);
}
| {
"array_type": 0,
"break_continue_statement": 0,
"enum_type": 0,
"for_loop": 0,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 1,
"memory_management": 0,
"memory_operation": 0,
"pointer_type": 3,
"return_statement": 2,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 4,
"union_type": 0,
"while_loop": 0
} |
libosip2-5.3.1#osip_list_prep#osip_list_get_next.c | libosip2-5.3.1 | osip_list.c | osip_list_get_next | 13 | void *osip_list_get_next(osip_list_iterator_t *iterator) {
if (iterator->actual == ((void *)0)) {
return 0;
}
iterator->prev = &(iterator->actual->next);
iterator->actual = iterator->actual->next;
++(iterator->pos);
if ((0 != (*iterator).actual && (*iterator).pos < (*iterator).li->nb_elt)) {
return iterator->actual->element;
}
iterator->actual = 0;
return 0;
}
| {
"array_type": 0,
"break_continue_statement": 0,
"enum_type": 0,
"for_loop": 0,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 2,
"memory_management": 0,
"memory_operation": 0,
"pointer_type": 0,
"return_statement": 3,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 1,
"union_type": 0,
"while_loop": 0
} |
libxml2#parser_prep#xmlCtxtSetMaxAmplification.c | libxml2 | parser.c | xmlCtxtSetMaxAmplification | 5 | void
xmlCtxtSetMaxAmplification(xmlParserCtxtPtr ctxt, unsigned maxAmpl)
{
ctxt->maxAmpl = maxAmpl;
}
| {
"array_type": 0,
"break_continue_statement": 0,
"enum_type": 0,
"for_loop": 0,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 0,
"memory_management": 0,
"memory_operation": 0,
"pointer_type": 0,
"return_statement": 0,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 0,
"union_type": 0,
"while_loop": 0
} |
json.h#allow_no_commas_prep#json_write_pretty_array.c | json.h | allow_no_commas.c | json_write_pretty_array | 41 | char *json_write_pretty_array(const struct json_array_s *array, size_t depth,
const char *indent, const char *newline,
char *data) {
size_t k, m;
struct json_array_element_s *element;
*data++ = '[';
if (0 < array->length) {
for (k = 0; '\0' != newline[k]; k++) {
*data++ = newline[k];
}
for (element = array->start; 0 != element;
element = element->next) {
if (element != array->start) {
*data++ = ',';
for (k = 0; '\0' != newline[k]; k++) {
*data++ = newline[k];
}
}
for (k = 0; k < depth + 1; k++) {
for (m = 0; '\0' != indent[m]; m++) {
*data++ = indent[m];
}
}
data = json_write_pretty_value(element->value, depth + 1, indent, newline,
data);
if (0 == data) {
return 0;
}
}
for (k = 0; '\0' != newline[k]; k++) {
*data++ = newline[k];
}
for (k = 0; k < depth; k++) {
for (m = 0; '\0' != indent[m]; m++) {
*data++ = indent[m];
}
}
}
*data++ = ']';
return data;
}
| {
"array_type": 2,
"break_continue_statement": 0,
"enum_type": 0,
"for_loop": 8,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 3,
"memory_management": 0,
"memory_operation": 0,
"pointer_type": 1,
"return_statement": 2,
"struct_type": 2,
"switch_statement": 0,
"type_casting": 0,
"union_type": 0,
"while_loop": 0
} |
libxml2#xmlregexp_prep#xmlAutomataNewCountTrans.c | libxml2 | xmlregexp.c | xmlAutomataNewCountTrans | 49 | xmlAutomataStatePtr
xmlAutomataNewCountTrans(xmlAutomataPtr am, xmlAutomataStatePtr from,
xmlAutomataStatePtr to, const xmlChar *token,
int min, int max, void *data) {
xmlRegAtomPtr atom;
int counter;
if ((am == ((void *)0)) || (from == ((void *)0)) || (token == ((void *)0)))
return(((void *)0));
if (min < 0)
return(((void *)0));
if ((max < min) || (max < 1))
return(((void *)0));
atom = xmlRegNewAtom(am, XML_REGEXP_STRING);
if (atom == ((void *)0))
return(((void *)0));
atom->valuep = xmlStrdup(token);
if (atom->valuep == ((void *)0))
goto error;
atom->data = data;
if (min == 0)
atom->min = 1;
else
atom->min = min;
atom->max = max;
counter = xmlRegGetCounter(am);
if (counter < 0)
goto error;
am->counters[counter].min = min;
am->counters[counter].max = max;
if (to == ((void *)0)) {
to = xmlRegStatePush(am);
if (to == ((void *)0))
goto error;
}
xmlRegStateAddTrans(am, from, atom, to, counter, -1);
if (xmlRegAtomPush(am, atom) < 0)
goto error;
am->state = to;
if (to == ((void *)0))
to = am->state;
if (to == ((void *)0))
return(((void *)0));
if (min == 0)
xmlFAGenerateEpsilonTransition(am, from, to);
return(to);
error:
xmlRegFreeAtom(atom);
return(((void *)0));
}
| {
"array_type": 1,
"break_continue_statement": 0,
"enum_type": 0,
"for_loop": 0,
"function_pointer": 0,
"goto_statement": 4,
"if_statement": 13,
"memory_management": 0,
"memory_operation": 0,
"pointer_type": 0,
"return_statement": 7,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 13,
"union_type": 0,
"while_loop": 0
} |
gprolog-1.5.0#oper_supp_prep#Pl_Nth_Root_Exact.c | gprolog-1.5.0 | oper_supp.c | Pl_Nth_Root_Exact | 11 | unsigned
Pl_Nth_Root_Exact(unsigned y, unsigned n)
{
unsigned x;
if (y == 0)
return 0;
x = Pl_Nth_Root_Dn(y, n);
if (Pl_Power(x, n) != y)
return (unsigned) -1;
return x;
}
| {
"array_type": 0,
"break_continue_statement": 0,
"enum_type": 0,
"for_loop": 0,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 2,
"memory_management": 0,
"memory_operation": 0,
"pointer_type": 0,
"return_statement": 3,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 1,
"union_type": 0,
"while_loop": 0
} |
libxml2#relaxng_prep#xmlRelaxNGGetValidErrors.c | libxml2 | relaxng.c | xmlRelaxNGGetValidErrors | 15 | int
xmlRelaxNGGetValidErrors(xmlRelaxNGValidCtxtPtr ctxt,
xmlRelaxNGValidityErrorFunc * err,
xmlRelaxNGValidityWarningFunc * warn, void **ctx)
{
if (ctxt == ((void *)0))
return (-1);
if (err != ((void *)0))
*err = ctxt->error;
if (warn != ((void *)0))
*warn = ctxt->warning;
if (ctx != ((void *)0))
*ctx = ctxt->userData;
return (0);
}
| {
"array_type": 0,
"break_continue_statement": 0,
"enum_type": 0,
"for_loop": 0,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 4,
"memory_management": 0,
"memory_operation": 0,
"pointer_type": 0,
"return_statement": 2,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 4,
"union_type": 0,
"while_loop": 0
} |
heman#vec4_prep#kmVec4LengthSq.c | heman | vec4.c | kmVec4LengthSq | 3 | float kmVec4LengthSq(const kmVec4* pIn) {
return kmSQR(pIn->x) + kmSQR(pIn->y) + kmSQR(pIn->z) + kmSQR(pIn->w);
}
| {
"array_type": 0,
"break_continue_statement": 0,
"enum_type": 0,
"for_loop": 0,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 0,
"memory_management": 0,
"memory_operation": 0,
"pointer_type": 0,
"return_statement": 1,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 0,
"union_type": 0,
"while_loop": 0
} |
libxml2#list_prep#xmlListRemoveFirst.c | libxml2 | list.c | xmlListRemoveFirst | 13 | int
xmlListRemoveFirst(xmlListPtr l, void *data)
{
xmlLinkPtr lk;
if (l == ((void *)0))
return(0);
lk = xmlListLinkSearch(l, data);
if (lk != ((void *)0)) {
xmlLinkDeallocator(l, lk);
return 1;
}
return 0;
}
| {
"array_type": 0,
"break_continue_statement": 0,
"enum_type": 0,
"for_loop": 0,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 2,
"memory_management": 0,
"memory_operation": 0,
"pointer_type": 0,
"return_statement": 3,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 2,
"union_type": 0,
"while_loop": 0
} |
json.h#allow_global_object_prep#json_value_as_string.c | json.h | allow_global_object.c | json_value_as_string | 6 | struct json_string_s *json_value_as_string(struct json_value_s *const value) {
if (value->type != json_type_string) {
return 0;
}
return (struct json_string_s *)value->payload;
}
| {
"array_type": 0,
"break_continue_statement": 0,
"enum_type": 0,
"for_loop": 0,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 1,
"memory_management": 0,
"memory_operation": 0,
"pointer_type": 0,
"return_statement": 2,
"struct_type": 1,
"switch_statement": 0,
"type_casting": 1,
"union_type": 0,
"while_loop": 0
} |
optipng-0.7.8#pngset_prep#png_set_chunk_malloc_max.c | optipng-0.7.8 | pngset.c | png_set_chunk_malloc_max | 7 | void
png_set_chunk_malloc_max(png_structrp png_ptr,
png_alloc_size_t user_chunk_malloc_max)
{
if (png_ptr != ((void *)0))
png_ptr->user_chunk_malloc_max = user_chunk_malloc_max;
}
| {
"array_type": 0,
"break_continue_statement": 0,
"enum_type": 0,
"for_loop": 0,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 1,
"memory_management": 0,
"memory_operation": 0,
"pointer_type": 0,
"return_statement": 0,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 1,
"union_type": 0,
"while_loop": 0
} |
libosip2-5.3.1#osip_authorization_prep#osip_authorization_set_uri.c | libosip2-5.3.1 | osip_authorization.c | osip_authorization_set_uri | 3 | void osip_authorization_set_uri(osip_authorization_t *authorization, char *uri) {
authorization->uri = (char *) uri;
}
| {
"array_type": 0,
"break_continue_statement": 0,
"enum_type": 0,
"for_loop": 0,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 0,
"memory_management": 0,
"memory_operation": 0,
"pointer_type": 0,
"return_statement": 0,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 1,
"union_type": 0,
"while_loop": 0
} |
cflow-1.7#argp-help_prep#argp_state_help.c | cflow-1.7 | argp-help.c | argp_state_help | 18 | void
argp_state_help (const struct argp_state *state, FILE *stream, unsigned flags)
{
if ((!state || ! (state->flags & 0x02)) && stream)
{
if (state && (state->flags & 0x40))
flags |= 0x80;
_help (state ? state->root_argp : 0, state, stream, flags,
state ? state->name : (program_invocation_short_name));
if (!state || ! (state->flags & 0x20))
{
if (flags & 0x100)
exit (argp_err_exit_status);
if (flags & 0x200)
exit (0);
}
}
}
| {
"array_type": 0,
"break_continue_statement": 0,
"enum_type": 0,
"for_loop": 0,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 5,
"memory_management": 0,
"memory_operation": 0,
"pointer_type": 0,
"return_statement": 0,
"struct_type": 1,
"switch_statement": 0,
"type_casting": 0,
"union_type": 0,
"while_loop": 0
} |
tulipindicators-0.9.1#candles_prep#tc_big_white_candle.c | tulipindicators-0.9.1 | candles.c | tc_big_white_candle | 5 | int tc_big_white_candle(int size, TC_REAL const *const *inputs, tc_config const *options, tc_result *output) {
const TC_REAL *open = inputs[0]; const TC_REAL *high = inputs[1]; const TC_REAL *low = inputs[2]; const TC_REAL *close = inputs[3]; const int period = options->period; const TC_REAL div = 1.0 / period; TC_REAL avg_body_sum = 0; TC_REAL avg_total_sum = 0; if (period < 1) return 1; if (size < period) return 0; int i; for (i = 0; i < period; ++i) { avg_body_sum += (fabs(open[(i)] - close[(i)])); avg_total_sum += (high[(i)] - low[(i)]); }
while(i < size) { const TC_REAL top = (open[(i)] > close[(i)] ? open[(i)] : close[(i)]); const TC_REAL bottom = (open[(i)] < close[(i)] ? open[(i)] : close[(i)]); const TC_REAL body = (fabs(open[(i)] - close[(i)])); const TC_REAL total = (high[(i)] - low[(i)]); const TC_REAL upper = (high[(i)] - top); const TC_REAL lower = (bottom - low[(i)]); const TC_REAL avg_body = avg_body_sum * div; const TC_REAL avg_total = avg_total_sum * div; (void)top;(void)bottom;(void)body;(void)total; (void)upper;(void)lower;(void)avg_body;(void)avg_total; if ((open[i]<close[i]) && ((fabs(open[(i)] - close[(i)])) > (options->body_long * avg_body))) { do { const tc_hit hit = {i, (1L<<3)}; const int r = tc_result_add(output, hit); if (r != 0) return r; } while (0); } avg_body_sum += body; avg_body_sum -= (fabs(open[(i-period)] - close[(i-period)])); avg_total_sum += total; avg_total_sum -= (high[(i-period)] - low[(i-period)]); ++i; };
return 0;
}
| {
"array_type": 3,
"break_continue_statement": 0,
"enum_type": 0,
"for_loop": 1,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 2,
"memory_management": 0,
"memory_operation": 0,
"pointer_type": 4,
"return_statement": 3,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 1,
"union_type": 0,
"while_loop": 1
} |
gprolog-1.5.0#type_inl_c_prep#Pl_Blt_Non_Fd_Var.c | gprolog-1.5.0 | type_inl_c.c | Pl_Blt_Non_Fd_Var | 5 | Bool
Pl_Blt_Non_Fd_Var(WamWord x)
{
WamWord word, tag_mask; do { WamWord deref_last_word; word = x; ; do { ; deref_last_word = word; tag_mask = ((PlLong) (word) & ((PlULong)0x7)); if (tag_mask != (PlULong)0) break; word = *(((WamWord *) (word))); } while (word != deref_last_word); } while (0); return (!(tag_mask == (PlULong)0x5));
}
| {
"array_type": 0,
"break_continue_statement": 1,
"enum_type": 0,
"for_loop": 0,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 1,
"memory_management": 0,
"memory_operation": 0,
"pointer_type": 0,
"return_statement": 1,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 0,
"union_type": 0,
"while_loop": 1
} |
transcoder-set#LENGTH_OF_THE_LONGEST_ARITHMATIC_PROGRESSION_IN_A_SORTED_ARRAY_prep#sort.c | transcoder-set | LENGTH_OF_THE_LONGEST_ARITHMATIC_PROGRESSION_IN_A_SORTED_ARRAY.c | sort | 1 | void sort (int arr [ ], int n) {qsort (arr, n, sizeof(int), cmpfunc);}
| {
"array_type": 0,
"break_continue_statement": 0,
"enum_type": 0,
"for_loop": 0,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 0,
"memory_management": 0,
"memory_operation": 0,
"pointer_type": 0,
"return_statement": 0,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 1,
"union_type": 0,
"while_loop": 0
} |
transcoder-set#COUNT_PAIRS_DIFFERENCE_EQUAL_K_prep#max.c | transcoder-set | COUNT_PAIRS_DIFFERENCE_EQUAL_K.c | max | 1 | int max(int x, int y) { return (x > y)? x: y; }
| {
"array_type": 0,
"break_continue_statement": 0,
"enum_type": 0,
"for_loop": 0,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 0,
"memory_management": 0,
"memory_operation": 0,
"pointer_type": 0,
"return_statement": 1,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 0,
"union_type": 0,
"while_loop": 0
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.