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 |
|---|---|---|---|---|---|---|
mtools-4.0.43#strtonum_prep#strtou16.c | mtools-4.0.43 | strtonum.c | strtou16 | 3 | uint16_t strtou16(const char *nptr, char **endptr, int base) {
return (uint16_t) strtoul_with_range(nptr, endptr, base, (65535));
}
| {
"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#COUNTS_PATHS_POINT_REACH_ORIGIN_1_prep#f_gold.c | transcoder-set | COUNTS_PATHS_POINT_REACH_ORIGIN_1.c | f_gold | 15 | int f_gold ( int n, int m ) {
int dp [ n + 1 ] [ m + 1 ];
for ( int i = 0;
i <= n;
i ++ ) dp [ i ] [ 0 ] = 1;
for ( int i = 0;
i <= m;
i ++ ) dp [ 0 ] [ i ] = 1;
for ( int i = 1;
i <= n;
i ++ ) for ( int j = 1;
j <= m;
j ++ ) dp [ i ] [ j ] = dp [ i - 1 ] [ j ] + dp [ i ] [ j - 1 ];
return dp [ n ] [ m ];
}
| {
"array_type": 1,
"break_continue_statement": 0,
"enum_type": 0,
"for_loop": 4,
"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#CALCULATING_FACTORIALS_USING_STIRLING_APPROXIMATION_prep#main.c | transcoder-set | CALCULATING_FACTORIALS_USING_STIRLING_APPROXIMATION.c | main | 14 | int main(void) {
int n_success = 0;
double param0[] = {1.0,5.0,10.0,20.0,40.0,2.0,3.0,-1.0,4663.43115050185,-3722.039522409859};
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
} |
transcoder-set#SEARCH_ALMOST_SORTED_ARRAY_prep#len.c | transcoder-set | SEARCH_ALMOST_SORTED_ARRAY.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
} |
transcoder-set#MINIMUM_STEPS_TO_DELETE_A_STRING_AFTER_REPEATED_DELETION_OF_PALINDROME_SUBSTRINGS_prep#sort.c | transcoder-set | MINIMUM_STEPS_TO_DELETE_A_STRING_AFTER_REPEATED_DELETION_OF_PALINDROME_SUBSTRINGS.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
} |
nettle-3.9.1#arctwo_prep#nettle_arctwo128_set_key_gutmann.c | nettle-3.9.1 | arctwo.c | nettle_arctwo128_set_key_gutmann | 6 | void
nettle_arctwo128_set_key_gutmann (struct arctwo_ctx *ctx,
const uint8_t *key)
{
nettle_arctwo_set_key_ekb (ctx, 16, key, 1024);
}
| {
"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
} |
enscript-1.6.6#lex_prep#yyget_leng.c | enscript-1.6.6 | lex.c | yyget_leng | 4 | int yyget_leng (void)
{
return yyleng;
}
| {
"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
} |
tmux#screen-write_prep#screen_write_scrollup.c | tmux | screen-write.c | screen_write_scrollup | 20 | void
screen_write_scrollup(struct screen_write_ctx *ctx, u_int lines, u_int bg)
{
struct screen *s = ctx->s;
struct grid *gd = s->grid;
u_int i;
if (lines == 0)
lines = 1;
else if (lines > s->rlower - s->rupper + 1)
lines = s->rlower - s->rupper + 1;
if (bg != ctx->bg) {
screen_write_collect_flush(ctx, 1);
ctx->bg = bg;
}
for (i = 0; i < lines; i++) {
grid_view_scroll_region_up(gd, s->rupper, s->rlower, bg);
screen_write_collect_scroll(ctx);
}
ctx->scrolled += lines;
}
| {
"array_type": 0,
"break_continue_statement": 0,
"enum_type": 0,
"for_loop": 1,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 3,
"memory_management": 0,
"memory_operation": 0,
"pointer_type": 2,
"return_statement": 0,
"struct_type": 3,
"switch_statement": 0,
"type_casting": 0,
"union_type": 0,
"while_loop": 0
} |
mcsim-6.2.0#modelu_prep#GetVarValue.c | mcsim-6.2.0 | modelu.c | GetVarValue | 23 | double GetVarValue (HVAR hvar)
{
double dReturn = 0.0;
switch (GetVarType(hvar)) {
case 0x20000:
dReturn = vrgInputs[((int) ((hvar) & 0x0FFFF))].dVal;
break;
case 0x30000:
case 0x10000:
dReturn = vrgModelVars[((int) ((hvar) & 0x0FFFF))];
break;
case 0x40000:
{
PVMMAPSTRCT pvm;
pvm = &vrgvmGlo[((int) ((hvar) & 0x0FFFF))];
dReturn = *(PDOUBLE) pvm->pVar;
break;
}
default:
break;
}
return (dReturn);
}
| {
"array_type": 0,
"break_continue_statement": 4,
"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": 1,
"type_casting": 3,
"union_type": 0,
"while_loop": 0
} |
less-633#pattern_prep#is_null_pattern.c | less-633 | pattern.c | is_null_pattern | 4 | int is_null_pattern(regex_t * pattern)
{
return (pattern == ((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": 1,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 1,
"union_type": 0,
"while_loop": 0
} |
mcsim-6.2.0#modd_prep#GetVarPTR.c | mcsim-6.2.0 | modd.c | GetVarPTR | 6 | PVMMAPSTRCT GetVarPTR (PVMMAPSTRCT pvm, PSTR szName)
{
while (pvm && strcmp (szName, pvm->szName))
pvm = pvm->pvmNextVar;
return (pvm);
}
| {
"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": 1
} |
cflow-1.7#getprogname_prep#getprogname.c | cflow-1.7 | getprogname.c | getprogname | 5 | char const *
getprogname (void)
{
return program_invocation_short_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": 0,
"switch_statement": 0,
"type_casting": 1,
"union_type": 0,
"while_loop": 0
} |
transcoder-set#FIND_THE_NUMBER_OCCURRING_ODD_NUMBER_OF_TIMES_2_prep#f_gold.c | transcoder-set | FIND_THE_NUMBER_OCCURRING_ODD_NUMBER_OF_TIMES_2.c | f_gold | 7 | int f_gold ( int ar [ ], int ar_size ) {
int res = 0;
for ( int i = 0;
i < ar_size;
i ++ ) res = res ^ ar [ i ];
return res;
}
| {
"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
} |
libosip2-5.3.1#osip_from_prep#osip_from_clone.c | libosip2-5.3.1 | osip_from.c | osip_from_clone | 31 | int osip_from_clone(const osip_from_t *from, osip_from_t **dest) {
int i;
osip_from_t *fr;
*dest = ((void *)0);
if (from == ((void *)0))
return -2;
i = osip_from_init(&fr);
if (i != 0)
return i;
if (from->displayname != ((void *)0)) {
fr->displayname = osip_strdup(from->displayname);
if (fr->displayname == ((void *)0)) {
osip_from_free(fr);
return -4;
}
}
if (from->url != ((void *)0)) {
i = osip_uri_clone(from->url, &(fr->url));
if (i != 0) {
osip_from_free(fr);
return i;
}
}
i = osip_list_clone(&from->gen_params, &fr->gen_params, (int (*)(void *, void **)) & osip_uri_param_clone);
if (i != 0) {
osip_from_free(fr);
return i;
}
*dest = fr;
return 0;
}
| {
"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": 1,
"return_statement": 6,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 5,
"union_type": 0,
"while_loop": 0
} |
transcoder-set#CHECK_GIVEN_STRING_ROTATION_PALINDROME_prep#main.c | transcoder-set | CHECK_GIVEN_STRING_ROTATION_PALINDROME.c | main | 14 | int main(void) {
int n_success = 0;
char param0[][100] = {"aadaa","2674377254","11","0011000","26382426486138","111010111010","abccba","5191","1110101101","abcdecbe"};
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
} |
nano-7.2#move_prep#to_prev_word.c | nano-7.2 | move.c | to_prev_word | 6 | void to_prev_word(void)
{
linestruct *was_current = openfile->current;
do_prev_word();
edit_redraw(was_current, FLOWING);
}
| {
"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": 0,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 1,
"union_type": 0,
"while_loop": 0
} |
gprolog-1.5.0#stream_c_prep#Pl_Set_Debugger_Streams_2.c | gprolog-1.5.0 | stream_c.c | Pl_Set_Debugger_Streams_2 | 8 | void
Pl_Set_Debugger_Streams_2(WamWord sora_in_word, WamWord sora_out_word)
{
pl_stm_debugger_input = Pl_Get_Stream_Or_Alias(sora_in_word, 2);
pl_stm_debugger_output = Pl_Get_Stream_Or_Alias(sora_out_word, 3);
Pl_Reassign_Alias(pl_atom_debugger_input, pl_stm_debugger_input);
Pl_Reassign_Alias(pl_atom_debugger_output, pl_stm_debugger_output);
}
| {
"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
} |
heman#ops_prep#heman_ops_max.c | heman | ops.c | heman_ops_max | 16 | heman_image* heman_ops_max(heman_image* imga, heman_image* imgb)
{
((void) sizeof ((imga->width == imgb->width) ? 1 : 0), __extension__ ({ if (imga->width == imgb->width) ; else __assert_fail ("imga->width == imgb->width", "/home/melih/storage/Transpiler/Dataset/projects/codebases_v2/heman/src/ops.c", 30, __extension__ __PRETTY_FUNCTION__); }));
((void) sizeof ((imga->height == imgb->height) ? 1 : 0), __extension__ ({ if (imga->height == imgb->height) ; else __assert_fail ("imga->height == imgb->height", "/home/melih/storage/Transpiler/Dataset/projects/codebases_v2/heman/src/ops.c", 31, __extension__ __PRETTY_FUNCTION__); }));
((void) sizeof ((imga->nbands == imgb->nbands) ? 1 : 0), __extension__ ({ if (imga->nbands == imgb->nbands) ; else __assert_fail ("imga->nbands == imgb->nbands", "/home/melih/storage/Transpiler/Dataset/projects/codebases_v2/heman/src/ops.c", 32, __extension__ __PRETTY_FUNCTION__); }));
heman_image* result =
heman_image_create(imga->width, imga->height, imga->nbands);
int size = imga->height * imga->width * imga->nbands;
float* srca = imga->data;
float* srcb = imgb->data;
float* dst = result->data;
for (int i = 0; i < size; ++i, ++dst, ++srca, ++srcb) {
*dst = (*srca > *srcb ? *srca : *srcb);
}
return result;
}
| {
"array_type": 0,
"break_continue_statement": 0,
"enum_type": 0,
"for_loop": 1,
"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": 3,
"union_type": 0,
"while_loop": 0
} |
bc-1.07.1#main_prep#new_yy_file.c | bc-1.07.1 | main.c | new_yy_file | 7 | void
new_yy_file (FILE *file)
{
if (!first_file) fclose (yyin);
yyin = file;
first_file = 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": 0,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 0,
"union_type": 0,
"while_loop": 0
} |
mtools-4.0.43#mainloop_prep#init_mp.c | mtools-4.0.43 | mainloop.c | init_mp | 15 | void init_mp(MainParam_t *mp)
{
fix_mcwd(mp->mcwd);
mp->openflags = 00;
mp->lookupflags = 0;
mp->targetName = 0;
mp->targetDir = 0;
mp->dirCallback = dispatchToFile;
mp->unixcallback = ((void *)0);
mp->shortname.data = mp->longname.data = 0;
mp->shortname.len = mp->longname.len = 0;
mp->File = 0;
mp->fast_quit = 0;
mp->originalArg = 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
} |
cpio-2.14#paxerror_prep#seek_warn_details.c | cpio-2.14 | paxerror.c | seek_warn_details | 7 | void
seek_warn_details (char const *name, off_t offset)
{
intmax_t off = offset;
int e = (*__errno_location ());
do { if (error_hook) error_hook (); error (0, e, gettext ("%s: Warning: Cannot seek to %jd"), quotearg_colon (name), off); } while (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": 0,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 0,
"union_type": 0,
"while_loop": 1
} |
mtools-4.0.43#devices_prep#send_one_cmd.c | mtools-4.0.43 | devices.c | send_one_cmd | 26 | int send_one_cmd(int fd, RawRequest_t *raw_cmd, const char *message)
{
if (ioctl( fd, (((0U) << (((0 +8)+8)+14)) | (((2)) << (0 +8)) | (((0x58)) << 0) | ((0) << ((0 +8)+8))), raw_cmd) >= 0) {
if (raw_cmd->reply_count < 7) {
fprintf(stderr,"Short reply from FDC\n");
return -1;
}
return 0;
}
switch((*__errno_location ())) {
case 16:
fprintf(stderr, "FDC busy, sleeping for a second\n");
sleep(1);
return 1;
case 5:
fprintf(stderr,"resetting controller\n");
if(ioctl(fd, (((0U) << (((0 +8)+8)+14)) | (((2)) << (0 +8)) | (((0x54)) << 0) | ((0) << ((0 +8)+8))), 2) < 0){
perror("reset");
return -1;
}
return 1;
default:
perror(message);
return -1;
}
}
| {
"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": 6,
"struct_type": 0,
"switch_statement": 1,
"type_casting": 0,
"union_type": 0,
"while_loop": 0
} |
tinycc#tccgen_prep#tcc_debug_funcstart.c | tinycc | tccgen.c | tcc_debug_funcstart | 13 | void tcc_debug_funcstart(TCCState *s1, Sym *sym)
{
char buf[512];
if (!s1->do_debug)
return;
snprintf(buf, sizeof(buf), "%s:%c1",
funcname, sym->type.t & 0x00002000 ? 'f' : 'F');
put_stabs_r(buf, N_FUN, 0, file->line_num, 0,
cur_text_section, sym->c);
put_stabn(N_SLINE, 0, file->line_num, 0);
last_ind = 0;
last_line_num = 0;
}
| {
"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": 1,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 0,
"union_type": 0,
"while_loop": 0
} |
transcoder-set#COMPUTE_MODULUS_DIVISION_BY_A_POWER_OF_2_NUMBER_prep#min.c | transcoder-set | COMPUTE_MODULUS_DIVISION_BY_A_POWER_OF_2_NUMBER.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
} |
libxml2#SAX2_prep#xmlSAX2SetDocumentLocator.c | libxml2 | SAX2.c | xmlSAX2SetDocumentLocator | 4 | void
xmlSAX2SetDocumentLocator(void *ctx __attribute__((unused)), xmlSAXLocatorPtr loc __attribute__((unused)))
{
}
| {
"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
} |
tinycc#tccpp_prep#tok_str_add_tok.c | tinycc | tccpp.c | tok_str_add_tok | 10 | void tok_str_add_tok(TokenString *s)
{
CValue cval;
if (file->line_num != s->last_line_num) {
s->last_line_num = file->line_num;
cval.i = s->last_line_num;
tok_str_add2(s, 0xc0, &cval);
}
tok_str_add2(s, tok, &tokc);
}
| {
"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": 0,
"union_type": 0,
"while_loop": 0
} |
libxml2#pattern_prep#xmlFreeStreamCtxt.c | libxml2 | pattern.c | xmlFreeStreamCtxt | 11 | void
xmlFreeStreamCtxt(xmlStreamCtxtPtr stream) {
xmlStreamCtxtPtr next;
while (stream != ((void *)0)) {
next = stream->next;
if (stream->states != ((void *)0))
xmlFree(stream->states);
xmlFree(stream);
stream = next;
}
}
| {
"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": 2,
"union_type": 0,
"while_loop": 1
} |
tmux#cmd_prep#cmd_print.c | tmux | cmd.c | cmd_print | 12 | char *
cmd_print(struct cmd *cmd)
{
char *out, *s;
s = args_print(cmd->args);
if (*s != '\0')
xasprintf(&out, "%s %s", cmd->entry->name, s);
else
out = xstrdup(cmd->entry->name);
free(s);
return (out);
}
| {
"array_type": 0,
"break_continue_statement": 0,
"enum_type": 0,
"for_loop": 0,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 1,
"memory_management": 1,
"memory_operation": 0,
"pointer_type": 2,
"return_statement": 1,
"struct_type": 1,
"switch_statement": 0,
"type_casting": 0,
"union_type": 0,
"while_loop": 0
} |
lil#lil_prep#lil_get_var_or.c | lil | lil.c | lil_get_var_or | 12 | lil_value_t lil_get_var_or(lil_t lil, const char* name, lil_value_t defvalue)
{
lil_var_t var = lil_find_var(lil, lil->env, name);
lil_value_t retval = var ? var->v : defvalue;
if (lil->callback[7] && (!var || var->env == lil->rootenv)) {
lil_getvar_callback_proc_t proc = (lil_getvar_callback_proc_t)lil->callback[7];
lil_value_t newretval = retval;
if (proc(lil, name, &newretval))
retval = newretval;
}
return retval;
}
| {
"array_type": 1,
"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": 0,
"union_type": 0,
"while_loop": 0
} |
libxml2#xmlreader_prep#xmlTextReaderHasValue.c | libxml2 | xmlreader.c | xmlTextReaderHasValue | 24 | int
xmlTextReaderHasValue(xmlTextReaderPtr reader) {
xmlNodePtr node;
if (reader == ((void *)0))
return(-1);
if (reader->node == ((void *)0))
return(0);
if (reader->curnode != ((void *)0))
node = reader->curnode;
else
node = reader->node;
switch (node->type) {
case XML_ATTRIBUTE_NODE:
case XML_TEXT_NODE:
case XML_CDATA_SECTION_NODE:
case XML_PI_NODE:
case XML_COMMENT_NODE:
case XML_NAMESPACE_DECL:
return(1);
default:
break;
}
return(0);
}
| {
"array_type": 0,
"break_continue_statement": 1,
"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": 4,
"struct_type": 0,
"switch_statement": 1,
"type_casting": 3,
"union_type": 0,
"while_loop": 0
} |
wget-1.21.4#ptimer_prep#ptimer_measure.c | wget-1.21.4 | ptimer.c | ptimer_measure | 16 | double
ptimer_measure (struct ptimer *pt)
{
ptimer_system_time now;
double elapsed;
posix_measure (&now);
elapsed = pt->elapsed_pre_start + posix_diff (&now, &pt->start);
if (elapsed < pt->elapsed_last)
{
pt->start = now;
pt->elapsed_pre_start = pt->elapsed_last;
elapsed = pt->elapsed_last;
}
pt->elapsed_last = elapsed;
return elapsed;
}
| {
"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": 1,
"switch_statement": 0,
"type_casting": 0,
"union_type": 0,
"while_loop": 0
} |
libosip2-5.3.1#nict_prep#osip_nict_set_destination.c | libosip2-5.3.1 | nict.c | osip_nict_set_destination | 9 | int osip_nict_set_destination(osip_nict_t *nict, char *destination, int port) {
if (nict == ((void *)0))
return -2;
if (nict->destination != ((void *)0))
{ if (nict->destination != ((void *)0)) { if (osip_free_func) osip_free_func(nict->destination); else free(nict->destination); } };
nict->destination = destination;
nict->port = port;
return 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": 1,
"memory_operation": 0,
"pointer_type": 0,
"return_statement": 2,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 3,
"union_type": 0,
"while_loop": 0
} |
bc-1.07.1#scan_prep#yyalloc.c | bc-1.07.1 | scan.c | yyalloc | 4 | void *yyalloc (yy_size_t size )
{
return (void *) malloc( size );
}
| {
"array_type": 0,
"break_continue_statement": 0,
"enum_type": 0,
"for_loop": 0,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 0,
"memory_management": 1,
"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#N_TH_TERM_SERIES_2_12_36_80_150_prep#len.c | transcoder-set | N_TH_TERM_SERIES_2_12_36_80_150.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
} |
tmux#server_prep#server_is_marked.c | tmux | server.c | server_is_marked | 11 | int
server_is_marked(struct session *s, struct winlink *wl, struct window_pane *wp)
{
if (s == ((void *)0) || wl == ((void *)0) || wp == ((void *)0))
return (0);
if (marked_pane.s != s || marked_pane.wl != wl)
return (0);
if (marked_pane.wp != wp)
return (0);
return (server_check_marked());
}
| {
"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": 4,
"struct_type": 1,
"switch_statement": 0,
"type_casting": 1,
"union_type": 0,
"while_loop": 0
} |
libxml2#xpath_prep#xmlXPathNewFloat.c | libxml2 | xpath.c | xmlXPathNewFloat | 11 | xmlXPathObjectPtr
xmlXPathNewFloat(double val) {
xmlXPathObjectPtr ret;
ret = (xmlXPathObjectPtr) xmlMalloc(sizeof(xmlXPathObject));
if (ret == ((void *)0))
return(((void *)0));
memset(ret, 0 , sizeof(xmlXPathObject));
ret->type = XPATH_NUMBER;
ret->floatval = val;
return(ret);
}
| {
"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": 1,
"pointer_type": 0,
"return_statement": 2,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 2,
"union_type": 0,
"while_loop": 0
} |
json.h#allow_equals_in_object_prep#json_write_minified.c | json.h | allow_equals_in_object.c | json_write_minified | 26 | void *json_write_minified(const struct json_value_s *value, size_t *out_size) {
size_t size = 0;
char *data = 0;
char *data_end = 0;
if (0 == value) {
return 0;
}
if (json_write_minified_get_value_size(value, &size)) {
return 0;
}
size += 1;
data = (char *)malloc(size);
if (0 == data) {
return 0;
}
data_end = json_write_minified_value(value, data);
if (0 == data_end) {
free(data);
return 0;
}
*data_end = '\0';
if (0 != out_size) {
*out_size = size;
}
return data;
}
| {
"array_type": 0,
"break_continue_statement": 0,
"enum_type": 0,
"for_loop": 0,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 5,
"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": 0
} |
less-633#ifile_prep#get_altpipe.c | less-633 | ifile.c | get_altpipe | 4 | void *get_altpipe(void* ifile)
{
return (((struct ifile *)(ifile))->h_altpipe);
}
| {
"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
} |
gawk-5.2.2#awkgram_prep#make_regnode.c | gawk-5.2.2 | awkgram.c | make_regnode | 20 | NODE *
make_regnode(NODETYPE type, NODE *exp)
{
NODE *n;
((void) (0));
(void) ((n = (NODE *) nextfree[BLOCK_NODE].freep) ? (NODE *) (nextfree[BLOCK_NODE].freep = ((struct block_item *) n)->freep) : (n = (NODE *) more_blocks(BLOCK_NODE)));
memset(n, 0, sizeof(NODE));
n->type = type;
n->flags = 1;
if (type == Node_regex) {
n->sub.nodep.r.preg[0] = make_regexp(exp->sub.val.sp, exp->sub.val.slen, 0, 1, 0);
if (n->sub.nodep.r.preg[0] == ((void *)0)) {
(void) (((struct block_item *) n)->freep = nextfree[BLOCK_NODE].freep, nextfree[BLOCK_NODE].freep = (struct block_item *) n);
return ((void *)0);
}
n->sub.nodep.x.extra = exp;
n->sub.nodep.reflags = CONSTANT;
}
return n;
}
| {
"array_type": 2,
"break_continue_statement": 0,
"enum_type": 0,
"for_loop": 0,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 2,
"memory_management": 0,
"memory_operation": 1,
"pointer_type": 1,
"return_statement": 2,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 5,
"union_type": 0,
"while_loop": 0
} |
heman#quaternion_prep#kmQuaternionSubtract.c | heman | quaternion.c | kmQuaternionSubtract | 7 | kmQuaternion* kmQuaternionSubtract(kmQuaternion* pOut, const kmQuaternion* pQ1, const kmQuaternion* pQ2) {
pOut->x = pQ1->x - pQ2->x;
pOut->y = pQ1->y - pQ2->y;
pOut->z = pQ1->z - pQ2->z;
pOut->w = pQ1->w - pQ2->w;
return pOut;
}
| {
"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#N_TH_NUMBER_WHOSE_SUM_OF_DIGITS_IS_TEN_1_prep#cmpfunc.c | transcoder-set | N_TH_NUMBER_WHOSE_SUM_OF_DIGITS_IS_TEN_1.c | cmpfunc | 1 | int cmpfunc (const void * a, const void * b) {return ( *(int*)a - *(int*)b );}
| {
"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
} |
cpio-2.14#util_prep#fchown_or_chown.c | cpio-2.14 | util.c | fchown_or_chown | 8 | int
fchown_or_chown (int fd, const char *name, uid_t uid, uid_t gid)
{
if (1 && fd != -1)
return fchown (fd, uid, gid);
else
return chown (name, uid, gid);
}
| {
"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": 0,
"union_type": 0,
"while_loop": 0
} |
tulipindicators-0.9.1#tiamalgamation_prep#ti_hma.c | tulipindicators-0.9.1 | tiamalgamation.c | ti_hma | 54 | int ti_hma(int size, double const *const *inputs, double const *options, double *const *outputs) {
const double *input = inputs[0];
const int period = (int)options[0];
double *output = outputs[0];
if (period < 1) return 1;
if (size <= ti_hma_start(options)) return 0;
const int period2 = (int)(period / 2);
const int periodsqrt = (int)(sqrt(period));
const double weights = period * (period+1) / 2;
const double weights2 = period2 * (period2+1) / 2;
const double weightssqrt = periodsqrt * (periodsqrt+1) / 2;
double sum = 0;
double weight_sum = 0;
double sum2 = 0;
double weight_sum2 = 0;
double sumsqrt = 0;
double weight_sumsqrt = 0;
int i;
for (i = 0; i < period-1; ++i) {
weight_sum += input[i] * (i+1);
sum += input[i];
if (i >= period - period2) {
weight_sum2 += input[i] * (i+1-(period-period2));
sum2 += input[i];
}
}
ti_buffer *buff = ti_buffer_new(periodsqrt);
for (i = period-1; i < size; ++i) {
weight_sum += input[i] * period;
sum += input[i];
weight_sum2 += input[i] * period2;
sum2 += input[i];
const double wma = weight_sum / weights;
const double wma2 = weight_sum2 / weights2;
const double diff = 2 * wma2 - wma;
weight_sumsqrt += diff * periodsqrt;
sumsqrt += diff;
do { (buff)->vals[(buff)->index] = (diff); (buff)->index = ((buff)->index + 1); if ((buff)->index >= (buff)->size) (buff)->index = 0; } while (0);
if (i >= (period-1) + (periodsqrt-1)) {
*output++ = weight_sumsqrt / weightssqrt;
weight_sumsqrt -= sumsqrt;
sumsqrt -= ((buff)->vals[((buff)->index + (buff)->size - 1 + (1)) % (buff)->size]);
} else {
weight_sumsqrt -= sumsqrt;
}
weight_sum -= sum;
sum -= input[i-period+1];
weight_sum2 -= sum2;
sum2 -= input[i-period2+1];
}
ti_buffer_free(buff);
((void) sizeof ((output - outputs[0] == size - ti_hma_start(options)) ? 1 : 0), __extension__ ({ if (output - outputs[0] == size - ti_hma_start(options)) ; else __assert_fail ("output - outputs[0] == size - ti_hma_start(options)", "tiamalgamation.c", 2592, __extension__ __PRETTY_FUNCTION__); }));
return 0;
}
| {
"array_type": 4,
"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": 3,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 4,
"union_type": 0,
"while_loop": 1
} |
gawk-5.2.2#debug_prep#do_save.c | gawk-5.2.2 | debug.c | do_save | 25 | int
do_save(CMDARG *arg, int cmd __attribute__ ((__unused__)))
{
FILE *fp;
HIST_ENTRY **hist_list;
int i;
if ((fp = fopen(arg->value.sval, "w")) == ((void *)0)) {
d_error(gettext("could not open `%s' for writing: %s"),
arg->value.sval, strerror((*__errno_location ())));
return 0;
}
hist_list = history_list();
if (hist_list && history_length > sess_history_base) {
for (i = sess_history_base; hist_list[i] != ((void *)0); i++) {
char *line;
line = hist_list[i]->line;
if (strlen(line) > 1
&& strncmp(line, "sa", 2) == 0)
continue;
fprintf(fp, "%s\n", line);
}
}
fclose(fp);
return 0;
}
| {
"array_type": 1,
"break_continue_statement": 1,
"enum_type": 0,
"for_loop": 1,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 3,
"memory_management": 0,
"memory_operation": 0,
"pointer_type": 3,
"return_statement": 2,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 2,
"union_type": 0,
"while_loop": 0
} |
optipng-0.7.8#deflate_prep#deflateInit_.c | optipng-0.7.8 | deflate.c | deflateInit_ | 5 | int deflateInit_(z_streamp strm, int level, const char *version,
int stream_size) {
return deflateInit2_(strm, level, 8, 15, 8,
0, version, stream_size);
}
| {
"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
} |
json.h#allow_single_quoted_strings_prep#json_parse_object.c | json.h | allow_single_quoted_strings.c | json_parse_object | 89 | void json_parse_object(struct json_parse_state_s *state, int is_global_object,
struct json_object_s *object) {
const size_t flags_bitset = state->flags_bitset;
const size_t size = state->size;
const char *const src = state->src;
size_t elements = 0;
int allow_comma = 0;
struct json_object_element_s *previous = 0;
if (is_global_object) {
if ('{' == src[state->offset]) {
is_global_object = 0;
}
}
if (!is_global_object) {
state->offset++;
}
(void)json_skip_all_skippables(state);
elements = 0;
while (state->offset < size) {
struct json_object_element_s *element = 0;
struct json_string_s *string = 0;
struct json_value_s *value = 0;
if (!is_global_object) {
(void)json_skip_all_skippables(state);
if ('}' == src[state->offset]) {
state->offset++;
break;
}
} else {
if (json_skip_all_skippables(state)) {
break;
}
}
if (allow_comma) {
if (',' == src[state->offset]) {
state->offset++;
allow_comma = 0;
continue;
}
}
element = (struct json_object_element_s *)state->dom;
state->dom += sizeof(struct json_object_element_s);
if (0 == previous) {
object->start = element;
} else {
previous->next = element;
}
previous = element;
if (json_parse_flags_allow_location_information & flags_bitset) {
struct json_string_ex_s *string_ex =
(struct json_string_ex_s *)state->dom;
state->dom += sizeof(struct json_string_ex_s);
string_ex->offset = state->offset;
string_ex->line_no = state->line_no;
string_ex->row_no = state->offset - state->line_offset;
string = &(string_ex->string);
} else {
string = (struct json_string_s *)state->dom;
state->dom += sizeof(struct json_string_s);
}
element->name = string;
(void)json_parse_key(state, string);
(void)json_skip_all_skippables(state);
state->offset++;
(void)json_skip_all_skippables(state);
if (json_parse_flags_allow_location_information & flags_bitset) {
struct json_value_ex_s *value_ex = (struct json_value_ex_s *)state->dom;
state->dom += sizeof(struct json_value_ex_s);
value_ex->offset = state->offset;
value_ex->line_no = state->line_no;
value_ex->row_no = state->offset - state->line_offset;
value = &(value_ex->value);
} else {
value = (struct json_value_s *)state->dom;
state->dom += sizeof(struct json_value_s);
}
element->value = value;
json_parse_value(state, 0, value);
elements++;
allow_comma = 1;
}
if (previous) {
previous->next = 0;
}
if (0 == elements) {
object->start = 0;
}
object->length = elements;
}
| {
"array_type": 0,
"break_continue_statement": 3,
"enum_type": 0,
"for_loop": 0,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 13,
"memory_management": 0,
"memory_operation": 0,
"pointer_type": 6,
"return_statement": 0,
"struct_type": 8,
"switch_statement": 0,
"type_casting": 15,
"union_type": 0,
"while_loop": 1
} |
libxml2#xmlsave_prep#xmlNodeDumpOutput.c | libxml2 | xmlsave.c | xmlNodeDumpOutput | 36 | void
xmlNodeDumpOutput(xmlOutputBufferPtr buf, xmlDocPtr doc, xmlNodePtr cur,
int level, int format, const char *encoding)
{
xmlSaveCtxt ctxt;
int options;
xmlDtdPtr dtd;
int is_xhtml = 0;
(void) doc;
xmlInitParser();
if ((buf == ((void *)0)) || (cur == ((void *)0))) return;
if (level < 0)
level = 0;
else if (level > 100)
level = 100;
if (encoding == ((void *)0))
encoding = "UTF-8";
memset(&ctxt, 0, sizeof(ctxt));
ctxt.buf = buf;
ctxt.level = level;
ctxt.encoding = (const xmlChar *) encoding;
options = XML_SAVE_AS_XML;
if (format)
options |= XML_SAVE_FORMAT;
xmlSaveCtxtInit(&ctxt, options);
dtd = xmlGetIntSubset(doc);
if (dtd != ((void *)0)) {
is_xhtml = xmlIsXHTML(dtd->SystemID, dtd->ExternalID);
if (is_xhtml < 0)
is_xhtml = 0;
}
if (is_xhtml)
xhtmlNodeDumpOutput(&ctxt, cur);
else
xmlNodeDumpOutputInternal(&ctxt, cur);
}
| {
"array_type": 0,
"break_continue_statement": 0,
"enum_type": 0,
"for_loop": 0,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 8,
"memory_management": 0,
"memory_operation": 1,
"pointer_type": 0,
"return_statement": 1,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 4,
"union_type": 0,
"while_loop": 0
} |
transcoder-set#PYTHON_PROGRAM_FIND_PERIMETER_CIRCUMFERENCE_SQUARE_RECTANGLE_1_prep#min.c | transcoder-set | PYTHON_PROGRAM_FIND_PERIMETER_CIRCUMFERENCE_SQUARE_RECTANGLE_1.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
} |
json-c#json_object_prep#json_object_array_shrink.c | json-c | json_object.c | json_object_array_shrink | 6 | int json_object_array_shrink(struct json_object *jso, int empty_slots)
{
if (empty_slots < 0)
json_abort("json_object_array_shrink called with negative empty_slots");
return array_list_shrink(JC_ARRAY(jso)->c_array, empty_slots);
}
| {
"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": 1,
"switch_statement": 0,
"type_casting": 0,
"union_type": 0,
"while_loop": 0
} |
libxml2#libxml2-py_prep#libxml_htmlNewDoc.c | libxml2 | libxml2-py.c | libxml_htmlNewDoc | 12 | PyObject *
libxml_htmlNewDoc(PyObject *self __attribute__ ((__unused__)), PyObject *args) {
PyObject *py_retval;
htmlDocPtr c_retval;
xmlChar * URI;
xmlChar * ExternalID;
if (!_PyArg_ParseTuple_SizeT(args, (char *)"zz:htmlNewDoc", &URI, &ExternalID))
return(((void *)0));
c_retval = htmlNewDoc(URI, ExternalID);
py_retval = libxml_xmlDocPtrWrap((xmlDocPtr) 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": 1,
"return_statement": 2,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 2,
"union_type": 0,
"while_loop": 0
} |
transcoder-set#FIND_INDEX_OF_AN_EXTRA_ELEMENT_PRESENT_IN_ONE_SORTED_ARRAY_1_prep#cmpfunc.c | transcoder-set | FIND_INDEX_OF_AN_EXTRA_ELEMENT_PRESENT_IN_ONE_SORTED_ARRAY_1.c | cmpfunc | 1 | int cmpfunc (const void * a, const void * b) {return ( *(int*)a - *(int*)b );}
| {
"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
} |
screen-4.9.0#layer_prep#LCDisplayLineWrap.c | screen-4.9.0 | layer.c | LCDisplayLineWrap | 13 | void LCDisplayLineWrap(struct layer *l, struct mline *ml, int y, int from, int to, int isblank)
{
struct mchar nc;
do { (&nc)->image = (ml)->image[0]; (&nc)->attr = (ml)->attr[0]; (&nc)->font = (ml)->font[0]; (&nc)->fontx = (ml)->fontx[0]; (&nc)->color = (ml)->color[0]; (&nc)->mbcs = 0; } while (0);
if (((l->l_encoding == 8) ? (unsigned char)(ml)->font[(0) + 1] == 0xff && (unsigned char)(ml)->image[(0) + 1] == 0xff : ((unsigned char)(ml)->font[0] & 0x1f) != 0 && ((unsigned char)(ml)->font[0] & 0xe0) == 0 )) {
nc.mbcs = ml->image[1];
from++;
}
LWrapChar(l, &nc, y - 1, -1, -1, 0);
from++;
if (from <= to)
LCDisplayLine(l, ml, y, from, to, isblank);
}
| {
"array_type": 5,
"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": 0,
"struct_type": 1,
"switch_statement": 0,
"type_casting": 0,
"union_type": 0,
"while_loop": 1
} |
libxml2#libxml2-py_prep#libxml_htmlSetMetaEncoding.c | libxml2 | libxml2-py.c | libxml_htmlSetMetaEncoding | 14 | PyObject *
libxml_htmlSetMetaEncoding(PyObject *self __attribute__ ((__unused__)), PyObject *args) {
PyObject *py_retval;
int c_retval;
htmlDocPtr doc;
PyObject *pyobj_doc;
xmlChar * encoding;
if (!_PyArg_ParseTuple_SizeT(args, (char *)"Oz:htmlSetMetaEncoding", &pyobj_doc, &encoding))
return(((void *)0));
doc = (htmlDocPtr) (((pyobj_doc) == (&_Py_NoneStruct)) ? ((void *)0) : (((PyxmlNode_Object *)(pyobj_doc))->obj));
c_retval = htmlSetMetaEncoding(doc, encoding);
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
} |
libxml2#xmlwriter_prep#xmlTextWriterWriteFormatCDATA.c | libxml2 | xmlwriter.c | xmlTextWriterWriteFormatCDATA | 11 | int
xmlTextWriterWriteFormatCDATA(xmlTextWriterPtr writer, const char *format,
...)
{
int rc;
va_list ap;
__builtin_va_start(ap,format);
rc = xmlTextWriterWriteVFormatCDATA(writer, format, ap);
__builtin_va_end(ap);
return rc;
}
| {
"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#arith_inl_c_prep#Pl_Fct_Atanh.c | gprolog-1.5.0 | arith_inl_c.c | Pl_Fct_Atanh | 5 | WamWord
Pl_Fct_Atanh(WamWord x)
{
return Make_Tagged_Float(atanh(To_Double(x)));
}
| {
"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#c_supp_prep#Pl_Mk_Codes.c | gprolog-1.5.0 | c_supp.c | Pl_Mk_Codes | 18 | WamWord
Pl_Mk_Codes(char *str)
{
WamWord res_word;
if (*str == '\0')
return (((PlLong) (256) << 3) + ((PlULong)0x3));
res_word = Pl_Put_List();
for (;;)
{
Pl_Unify_Integer(*str);
str++;
if (*str == '\0')
break;
Pl_Unify_List();
}
Pl_Unify_Nil();
return res_word;
}
| {
"array_type": 0,
"break_continue_statement": 1,
"enum_type": 0,
"for_loop": 1,
"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": 0,
"union_type": 0,
"while_loop": 0
} |
nettle-3.9.1#gmp-glue_prep#_nettle_mpn_get_base256.c | nettle-3.9.1 | gmp-glue.c | _nettle_mpn_get_base256 | 30 | void
_nettle_mpn_get_base256 (uint8_t *rp, size_t rn,
const mp_limb_t *xp, mp_size_t xn)
{
unsigned bits;
mp_limb_t in;
for (bits = in = 0; xn > 0 && rn > 0; )
{
if (bits >= 8)
{
rp[--rn] = in;
in >>= 8;
bits -= 8;
}
else
{
uint8_t old = in;
in = *xp++;
xn--;
rp[--rn] = old | (in << bits);
in >>= (8 - bits);
bits += (64 - 0) - 8;
}
}
while (rn > 0)
{
rp[--rn] = in;
in >>= 8;
}
}
| {
"array_type": 0,
"break_continue_statement": 0,
"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": 0,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 0,
"union_type": 0,
"while_loop": 1
} |
gprolog-1.5.0#c_supp_prep#Pl_Rd_Char_Check.c | gprolog-1.5.0 | c_supp.c | Pl_Rd_Char_Check | 13 | int
Pl_Rd_Char_Check(WamWord start_word)
{
WamWord word, tag_mask;
int atom;
do { WamWord deref_last_word; word = start_word; ; 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);
if (tag_mask == (PlULong)0)
Pl_Err_Instantiation();
atom = ((PlULong) (word) >> 3);
if (tag_mask != (PlULong)0x3 || pl_atom_tbl[atom].prop.length != 1)
Pl_Err_Type(pl_type_character, word);
return pl_atom_tbl[atom].name[0];
}
| {
"array_type": 2,
"break_continue_statement": 1,
"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
} |
lil#lil_prep#lil_subst_to_list.c | lil | lil.c | lil_subst_to_list | 19 | lil_list_t lil_subst_to_list(lil_t lil, lil_value_t code)
{
const char* save_code = lil->code;
size_t save_clen = lil->clen;
size_t save_head = lil->head;
int save_igeol = lil->ignoreeol;
lil_list_t words;
lil->code = lil_to_string(code);
lil->clen = code->l;
lil->head = 0;
lil->ignoreeol = 1;
words = substitute(lil);
if (!words) words = lil_alloc_list();
lil->code = save_code;
lil->clen = save_clen;
lil->head = save_head;
lil->ignoreeol = save_igeol;
return words;
}
| {
"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": 0,
"union_type": 0,
"while_loop": 0
} |
optipng-0.7.8#opngreduc_prep#opng_validate_image.c | optipng-0.7.8 | opngreduc.c | opng_validate_image | 15 | int
opng_validate_image(png_structp png_ptr, png_infop info_ptr)
{
((void)0);
if (png_get_bit_depth(png_ptr, info_ptr) == 0)
return 0;
if (png_get_color_type(png_ptr, info_ptr) & 1)
{
if (!png_get_valid(png_ptr, info_ptr, 0x0008U))
return 0;
}
if (!png_get_valid(png_ptr, info_ptr, 0x8000U))
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": 4,
"memory_management": 0,
"memory_operation": 0,
"pointer_type": 0,
"return_statement": 4,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 1,
"union_type": 0,
"while_loop": 0
} |
pth-2.0.7#pth_lib_prep#pth_raise.c | pth-2.0.7 | pth_lib.c | pth_raise | 20 | int pth_raise(pth_t t, int sig)
{
struct sigaction sa;
if (t == ((void *)0) || t == __pth_current || (sig < 0 || sig > 65))
return ((*__errno_location ()) = (22), ((0)));
if (sig == 0)
return __pth_thread_exists(t);
else {
if (sigaction(sig, ((void *)0), &sa) != 0)
return (0);
if (sa.__sigaction_handler.sa_handler == ((__sighandler_t) 1))
return (!(0));
if (!sigismember(&t->sigpending, sig)) {
sigaddset(&t->sigpending, sig);
t->sigpendcnt++;
}
pth_yield(t);
return (!(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": 5,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 2,
"union_type": 0,
"while_loop": 0
} |
transcoder-set#CHECK_LARGE_NUMBER_DIVISIBLE_4_NOT_prep#f_filled.c | transcoder-set | CHECK_LARGE_NUMBER_DIVISIBLE_4_NOT.c | f_filled | 1 | _Bool f_filled ( char 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": 0,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 0,
"union_type": 0,
"while_loop": 0
} |
rcs-5.10.1#rcsfnms_prep#basefilename.c | rcs-5.10.1 | rcsfnms.c | basefilename | 14 | char const *
basefilename (char const *p)
{
register char const *b = p, *q = p;
for (;;)
switch (*q++)
{
case '/':
b = q;
break;
case 0:
return b;
}
}
| {
"array_type": 0,
"break_continue_statement": 1,
"enum_type": 0,
"for_loop": 1,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 0,
"memory_management": 0,
"memory_operation": 0,
"pointer_type": 2,
"return_statement": 1,
"struct_type": 0,
"switch_statement": 1,
"type_casting": 0,
"union_type": 0,
"while_loop": 0
} |
mcsim-6.2.0#simo_prep#CloseMCFiles.c | mcsim-6.2.0 | simo.c | CloseMCFiles | 5 | void CloseMCFiles (PANALYSIS panal)
{
fclose (panal->mc.pfileMCOut);
printf ("\nWrote results to \"%s\"\n", panal->mc.szMCOutfilename);
}
| {
"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
} |
libosip2-5.3.1#osip_uri_prep#osip_uri_param_freelist.c | libosip2-5.3.1 | osip_uri.c | osip_uri_param_freelist | 8 | void osip_uri_param_freelist(osip_list_t *params) {
osip_uri_param_t *u_param;
while (!osip_list_eol(params, 0)) {
u_param = (osip_uri_param_t *) osip_list_get(params, 0);
osip_list_remove(params, 0);
osip_uri_param_free(u_param);
}
}
| {
"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": 0,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 0,
"union_type": 0,
"while_loop": 1
} |
libxml2#xmlmemory_prep#xmlMemoryStrdup.c | libxml2 | xmlmemory.c | xmlMemoryStrdup | 21 | char *
xmlMemoryStrdup(const char *str) {
char *s;
size_t size = strlen(str) + 1;
MEMHDR *p;
xmlInitParser();
if (size > (((size_t)-1) - (((sizeof(MEMHDR) + sizeof(double) - 1) / sizeof(double) ) * sizeof(double))))
return(((void *)0));
p = (MEMHDR *) malloc((((sizeof(MEMHDR) + sizeof(double) - 1) / sizeof(double) ) * sizeof(double)) + size);
if (!p)
return(((void *)0));
p->mh_tag = 0x5aa5U;
p->mh_size = size;
xmlMutexLock(&xmlMemMutex);
debugMemSize += size;
debugMemBlocks++;
xmlMutexUnlock(&xmlMemMutex);
s = (char *) ((void *) (((char *) (p)) + (((sizeof(MEMHDR) + sizeof(double) - 1) / sizeof(double) ) * sizeof(double))));
memcpy(s, str, size);
return(s);
}
| {
"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": 1,
"pointer_type": 2,
"return_statement": 3,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 5,
"union_type": 0,
"while_loop": 0
} |
transcoder-set#FIND_MINIMUM_DIFFERENCE_PAIR_1_prep#f_filled.c | transcoder-set | FIND_MINIMUM_DIFFERENCE_PAIR_1.c | f_filled | 1 | int f_filled ( int arr [ ], int n ) {}
| {
"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
} |
nettle-3.9.1#knuth-lfib_prep#nettle_knuth_lfib_init.c | nettle-3.9.1 | knuth-lfib.c | nettle_knuth_lfib_init | 46 | void
nettle_knuth_lfib_init(struct knuth_lfib_ctx *ctx, uint32_t seed)
{
uint32_t t,j;
uint32_t x[2*100 - 1];
uint32_t ss = (seed + 2) & ((1UL << 30)-2);
for (j = 0; j<100; j++)
{
x[j] = ss;
ss <<= 1; if (ss >= (1UL << 30)) ss -= ((1UL << 30)-2);
}
for (;j< 2*100 -1; j++)
x[j] = 0;
x[1]++;
ss = seed & ((1UL << 30)-1);
for (t = 70 -1; t; )
{
for (j = 100 -1; j>0; j--)
x[j+j] = x[j];
for (j = 2*100 -2; j > 100 -37; j-= 2)
x[2*100 -1-j] = x[j] & ~1;
for (j = 2*100 -2; j>=100; j--)
if (x[j] & 1)
{
x[j-(100 -37)] = (x[j - (100 -37)] - x[j]) & ((1UL << 30)-1);
x[j-100] = (x[j-100] - x[j]) & ((1UL << 30)-1);
}
if (ss & 1)
{
for (j=100; j>0; j--)
x[j] = x[j-1];
x[0] = x[100];
if (x[100] & 1)
x[37] = (x[37] - x[100]) & ((1UL << 30)-1);
}
if (ss)
ss >>= 1;
else
t--;
}
for (j=0; j<37; j++)
ctx->x[j+100 -37] = x[j];
for (; j<100; j++)
ctx->x[j-37] = x[j];
ctx->index = 0;
}
| {
"array_type": 1,
"break_continue_statement": 0,
"enum_type": 0,
"for_loop": 9,
"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#adx_prep#ti_adx.c | tulipindicators-0.9.1 | adx.c | ti_adx | 50 | int ti_adx(int size, double const *const *inputs, double const *options, double *const *outputs) {
const double *high = inputs[0];
const double *low = inputs[1];
const int period = (int)options[0];
double *output = outputs[0];
if (period < 2) return 1;
if (size <= ti_adx_start(options)) return 0;
const double per = ((double)period-1) / ((double)period);
const double invper = 1.0 / ((double)period);
double dmup = 0;
double dmdown = 0;
int i;
for (i = 1; i < period; ++i) {
double dp, dm;
do { dp = high[i] - high[i-1]; dm = low[i-1] - low[i]; if (dp < 0) dp = 0; else if (dp > dm) dm = 0; if (dm < 0) dm = 0; else if (dm > dp) dp = 0;} while (0);
dmup += dp;
dmdown += dm;
}
double adx = 0.0;
{
double di_up = dmup;
double di_down = dmdown;
double dm_diff = fabs(di_up - di_down);
double dm_sum = di_up + di_down;
double dx = dm_diff / dm_sum * 100;
adx += dx;
}
for (i = period; i < size; ++i) {
double dp, dm;
do { dp = high[i] - high[i-1]; dm = low[i-1] - low[i]; if (dp < 0) dp = 0; else if (dp > dm) dm = 0; if (dm < 0) dm = 0; else if (dm > dp) dp = 0;} while (0);
dmup = dmup * per + dp;
dmdown = dmdown * per + dm;
double di_up = dmup;
double di_down = dmdown;
double dm_diff = fabs(di_up - di_down);
double dm_sum = di_up + di_down;
double dx = dm_diff / dm_sum * 100;
if (i-period < period-2) {
adx += dx;
} else if (i-period == period-2) {
adx += dx;
*output++ = adx * invper;
} else {
adx = adx * per + dx;
*output++ = adx * invper;
}
}
((void) sizeof ((output - outputs[0] == size - ti_adx_start(options)) ? 1 : 0), __extension__ ({ if (output - outputs[0] == size - ti_adx_start(options)) ; else __assert_fail ("output - outputs[0] == size - ti_adx_start(options)", "indicators/adx.c", 102, __extension__ __PRETTY_FUNCTION__); }));
return 0;
}
| {
"array_type": 5,
"break_continue_statement": 0,
"enum_type": 0,
"for_loop": 2,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 7,
"memory_management": 0,
"memory_operation": 0,
"pointer_type": 3,
"return_statement": 3,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 4,
"union_type": 0,
"while_loop": 2
} |
uucp-1.07#xqtfil_prep#fsysdep_get_xqt_init.c | uucp-1.07 | xqtfil.c | fsysdep_get_xqt_init | 28 | boolean
fsysdep_get_xqt_init (zsystem)
const char *zsystem;
{
usysdep_get_xqt_free ((const char *) ((void *)0));
if (zsystem != ((void *)0))
{
zSdir = zsysdep_in_dir (zsystem, "X.");
qSxqt_dir = opendir ((char *) zSdir);
if (qSxqt_dir != ((void *)0))
{
qSxqt_topdir = qSxqt_dir;
fSone_dir = (1);
zSsystem = zbufcpy (zsystem);
return (1);
}
}
fSone_dir = (0);
qSxqt_topdir = opendir ((char *) ".");
if (qSxqt_topdir == ((void *)0))
{
if ((*__errno_location ()) == 2)
return (1);
ulog (LOG_ERROR, "opendir (%s): %s", ".", 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": 4,
"memory_management": 0,
"memory_operation": 0,
"pointer_type": 0,
"return_statement": 4,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 6,
"union_type": 0,
"while_loop": 0
} |
sed-4.9#localename_prep#gl_locale_name_default.c | sed-4.9 | localename.c | gl_locale_name_default | 5 | const char *
gl_locale_name_default (void)
{
return "C";
}
| {
"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
} |
tinycc#variadic_prep#tcc_warning.c | tinycc | variadic.c | tcc_warning | 10 | void tcc_warning(const char *fmt, ...)
{
TCCState *s1 = tcc_state;
va_list ap;
if (s1->warn_none)
return;
__builtin_va_start(ap,fmt);
error1(s1, 1, fmt, ap);
__builtin_va_end(ap);
}
| {
"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": 1,
"return_statement": 1,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 0,
"union_type": 0,
"while_loop": 0
} |
patch-2.7.6#patch_prep#copy_till.c | patch-2.7.6 | patch.c | copy_till | 27 | _Bool
copy_till (struct outstate *outstate, lin lastline)
{
lin R_last_frozen_line = last_frozen_line;
FILE *fp = outstate->ofp;
char const *s;
size_t size;
if (R_last_frozen_line > lastline)
{
say ("misordered hunks! output would be garbled\n");
return 0;
}
while (R_last_frozen_line < lastline)
{
s = ifetch (++R_last_frozen_line, 0, &size);
if (size)
{
if ((! outstate->after_newline && putc ('\n', fp) == (-1))
|| ! fwrite (s, sizeof *s, size, fp))
write_fatal ();
outstate->after_newline = s[size - 1] == '\n';
outstate->zero_output = 0;
}
}
last_frozen_line = R_last_frozen_line;
return 1;
}
| {
"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": 2,
"struct_type": 1,
"switch_statement": 0,
"type_casting": 0,
"union_type": 0,
"while_loop": 1
} |
transcoder-set#MINIMUM_LENGTH_SUBARRAY_SUM_GREATER_GIVEN_VALUE_1_prep#min.c | transcoder-set | MINIMUM_LENGTH_SUBARRAY_SUM_GREATER_GIVEN_VALUE_1.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
} |
transcoder-set#CHECK_IF_STRING_REMAINS_PALINDROME_AFTER_REMOVING_GIVEN_NUMBER_OF_CHARACTERS_prep#max.c | transcoder-set | CHECK_IF_STRING_REMAINS_PALINDROME_AFTER_REMOVING_GIVEN_NUMBER_OF_CHARACTERS.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
} |
brotli-1.0.9#block_splitter_prep#BrotliSplitBlock.c | brotli-1.0.9 | block_splitter.c | BrotliSplitBlock | 58 | void BrotliSplitBlock(MemoryManager* m,
const Command* cmds,
const size_t num_commands,
const uint8_t* data,
const size_t pos,
const size_t mask,
const BrotliEncoderParams* params,
BlockSplit* literal_split,
BlockSplit* insert_and_copy_split,
BlockSplit* dist_split) {
{
size_t literals_count = CountLiterals(cmds, num_commands);
uint8_t* literals = ((literals_count) > 0 ? ((uint8_t*)BrotliAllocate((m), (literals_count) * sizeof(uint8_t))) : ((void *)0));
if ((!!0) || (!!0)) return;
CopyLiteralsToByteArray(cmds, num_commands, data, pos, mask, literals);
SplitByteVectorLiteral(
m, literals, literals_count,
kSymbolsPerLiteralHistogram, kMaxLiteralHistograms,
kLiteralStrideLength, kLiteralBlockSwitchCost, params,
literal_split);
if ((!!0)) return;
{ BrotliFree((m), (literals)); literals = ((void *)0); };
}
{
uint16_t* insert_and_copy_codes = ((num_commands) > 0 ? ((uint16_t*)BrotliAllocate((m), (num_commands) * sizeof(uint16_t))) : ((void *)0));
size_t i;
if ((!!0) || (!!0)) return;
for (i = 0; i < num_commands; ++i) {
insert_and_copy_codes[i] = cmds[i].cmd_prefix_;
}
SplitByteVectorCommand(
m, insert_and_copy_codes, num_commands,
kSymbolsPerCommandHistogram, kMaxCommandHistograms,
kCommandStrideLength, kCommandBlockSwitchCost, params,
insert_and_copy_split);
if ((!!0)) return;
{ BrotliFree((m), (insert_and_copy_codes)); insert_and_copy_codes = ((void *)0); };
}
{
uint16_t* distance_prefixes = ((num_commands) > 0 ? ((uint16_t*)BrotliAllocate((m), (num_commands) * sizeof(uint16_t))) : ((void *)0));
size_t j = 0;
size_t i;
if ((!!0) || (!!0)) return;
for (i = 0; i < num_commands; ++i) {
const Command* cmd = &cmds[i];
if (CommandCopyLen(cmd) && cmd->cmd_prefix_ >= 128) {
distance_prefixes[j++] = cmd->dist_prefix_ & 0x3FF;
}
}
SplitByteVectorDistance(
m, distance_prefixes, j,
kSymbolsPerDistanceHistogram, kMaxCommandHistograms,
kCommandStrideLength, kDistanceBlockSwitchCost, params,
dist_split);
if ((!!0)) return;
{ BrotliFree((m), (distance_prefixes)); distance_prefixes = ((void *)0); };
}
}
| {
"array_type": 2,
"break_continue_statement": 0,
"enum_type": 0,
"for_loop": 2,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 7,
"memory_management": 0,
"memory_operation": 0,
"pointer_type": 0,
"return_statement": 6,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 6,
"union_type": 0,
"while_loop": 0
} |
mcsim-6.2.0#yourcode_prep#Definite_Integral.c | mcsim-6.2.0 | yourcode.c | Definite_Integral | 36 | double Definite_Integral (double (*Function)(double), double dFrom, double dTo)
{
double dTotal_Area, dDelta_Area;
double pdArea[25 +2], pdTemp[25 +2];
int i;
if (dFrom >= dTo) {
if (dFrom == dTo)
return (0);
else {
printf ("\nError: inverted integration bounds in Definite_Integral - "
"Exiting\n\n");
exit (0);
}
}
pdTemp[0] = 1;
for (i = 0; i < 25; i++) {
pdArea[i] = Trapezes (Function, dFrom, dTo, i+1);
if (i >= 4) {
Interpolate_Poly (&pdTemp[i-4], &pdArea[i-4], 4 + 1,
0.0, &dTotal_Area, &dDelta_Area);
if (dTotal_Area == 0) {
if (fabs(dDelta_Area) < 1.0e-6)
return dTotal_Area;
}
else {
if (fabs(dDelta_Area) < 1.0e-6 * fabs(dTotal_Area))
return dTotal_Area;
}
}
pdArea[i+1] = pdArea[i];
pdTemp[i+1] = 0.25 * pdTemp[i];
}
printf ("\nError: Too many steps in routine Definite_Integral "
"- Exiting\n\n");
exit (0);
}
| {
"array_type": 2,
"break_continue_statement": 0,
"enum_type": 0,
"for_loop": 1,
"function_pointer": 1,
"goto_statement": 0,
"if_statement": 6,
"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
} |
json.h#allow_leading_or_trailing_decimal_point_prep#json_hexadecimal_digit.c | json.h | allow_leading_or_trailing_decimal_point.c | json_hexadecimal_digit | 12 | int json_hexadecimal_digit(const char c) {
if ('0' <= c && c <= '9') {
return c - '0';
}
if ('a' <= c && c <= 'f') {
return c - 'a' + 10;
}
if ('A' <= c && c <= 'F') {
return c - 'A' + 10;
}
return -1;
}
| {
"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": 4,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 0,
"union_type": 0,
"while_loop": 0
} |
transcoder-set#PROGRAM_CHECK_PLUS_PERFECT_NUMBER_prep#len.c | transcoder-set | PROGRAM_CHECK_PLUS_PERFECT_NUMBER.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
} |
optipng-0.7.8#gzlib_prep#gzerror.c | optipng-0.7.8 | gzlib.c | gzerror | 12 | const char * gzerror(gzFile file, int *errnum) {
gz_statep state;
if (file == ((void *)0))
return ((void *)0);
state = (gz_statep)file;
if (state->mode != 7247 && state->mode != 31153)
return ((void *)0);
if (errnum != ((void *)0))
*errnum = state->err;
return state->err == (-4) ? "out of memory" :
(state->msg == ((void *)0) ? "" : state->msg);
}
| {
"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": 3,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 5,
"union_type": 0,
"while_loop": 0
} |
less-633#line_prep#set_status_col.c | less-633 | line.c | set_status_col | 4 | void set_status_col(char c, int attr)
{
set_pfx(0, c, attr);
}
| {
"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#MINIMUM_STEPS_TO_DELETE_A_STRING_AFTER_REPEATED_DELETION_OF_PALINDROME_SUBSTRINGS_prep#min.c | transcoder-set | MINIMUM_STEPS_TO_DELETE_A_STRING_AFTER_REPEATED_DELETION_OF_PALINDROME_SUBSTRINGS.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
} |
screen-4.9.0#tty_prep#brktty.c | screen-4.9.0 | tty.c | brktty | 5 | void brktty(int fd)
{
if (separate_sids)
setsid();
}
| {
"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": 0,
"union_type": 0,
"while_loop": 0
} |
optipng-0.7.8#optim_prep#opng_initialize.c | optipng-0.7.8 | optim.c | opng_initialize | 23 | int
opng_initialize(const struct opng_options *init_options,
const struct opng_ui *init_ui)
{
usr_printf = init_ui->printf_fn;
usr_print_cntrl = init_ui->print_cntrl_fn;
usr_progress = init_ui->progress_fn;
usr_panic = init_ui->panic_fn;
if (usr_printf == ((void *)0) ||
usr_print_cntrl == ((void *)0) ||
usr_progress == ((void *)0) ||
usr_panic == ((void *)0))
return -1;
s_options = *init_options;
if (s_options.optim_level == 0)
{
s_options.nb = s_options.nc = s_options.np = 1;
s_options.nz = 1;
}
memset(&s_summary, 0, sizeof(s_summary));
s_engine.started = 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": 1,
"pointer_type": 0,
"return_statement": 2,
"struct_type": 2,
"switch_statement": 0,
"type_casting": 4,
"union_type": 0,
"while_loop": 0
} |
libxml2#libxml2-py_prep#libxml_xmlRelaxNGParse.c | libxml2 | libxml2-py.c | libxml_xmlRelaxNGParse | 13 | PyObject *
libxml_xmlRelaxNGParse(PyObject *self __attribute__ ((__unused__)), PyObject *args) {
PyObject *py_retval;
xmlRelaxNGPtr c_retval;
xmlRelaxNGParserCtxtPtr ctxt;
PyObject *pyobj_ctxt;
if (!_PyArg_ParseTuple_SizeT(args, (char *)"O:xmlRelaxNGParse", &pyobj_ctxt))
return(((void *)0));
ctxt = (xmlRelaxNGParserCtxtPtr) (((pyobj_ctxt) == (&_Py_NoneStruct)) ? ((void *)0) : (((PyrelaxNgParserCtxt_Object *)(pyobj_ctxt))->obj));
c_retval = xmlRelaxNGParse(ctxt);
py_retval = libxml_xmlRelaxNGPtrWrap((xmlRelaxNGPtr) 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
} |
libosip2-5.3.1#osip_alert_info_prep#osip_message_get_alert_info.c | libosip2-5.3.1 | osip_alert_info.c | osip_message_get_alert_info | 9 | int osip_message_get_alert_info(const osip_message_t *sip, int pos, osip_alert_info_t **dest) {
osip_alert_info_t *alert_info;
*dest = ((void *)0);
if (osip_list_size(&sip->alert_infos) <= pos)
return -1;
alert_info = (osip_alert_info_t *) osip_list_get(&sip->alert_infos, pos);
*dest = alert_info;
return pos;
}
| {
"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": 1,
"return_statement": 2,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 1,
"union_type": 0,
"while_loop": 0
} |
libosip2-5.3.1#osip_cseq_prep#osip_message_set_cseq.c | libosip2-5.3.1 | osip_cseq.c | osip_message_set_cseq | 18 | int osip_message_set_cseq(osip_message_t *sip, const char *hvalue) {
int i;
if (hvalue == ((void *)0) || hvalue[0] == '\0')
return 0;
if (sip->cseq != ((void *)0))
return -2;
i = osip_cseq_init(&(sip->cseq));
if (i != 0)
return i;
sip->message_property = 2;
i = osip_cseq_parse(sip->cseq, hvalue);
if (i != 0) {
osip_cseq_free(sip->cseq);
sip->cseq = ((void *)0);
return i;
}
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": 0,
"switch_statement": 0,
"type_casting": 3,
"union_type": 0,
"while_loop": 0
} |
libxml2#xpath_prep#xmlXPathRoundFunction.c | libxml2 | xpath.c | xmlXPathRoundFunction | 17 | void
xmlXPathRoundFunction(xmlXPathParserContextPtr ctxt, int nargs) {
double f;
if (ctxt == ((void *)0)) return; if (nargs != (1)) { xmlXPathErr(ctxt, XPATH_INVALID_ARITY); return; }; if (ctxt->valueNr < (1)) { xmlXPathErr(ctxt, XPATH_STACK_ERROR); return; };;
if ((ctxt->value != ((void *)0)) && (ctxt->value->type != XPATH_NUMBER)) xmlXPathNumberFunction(ctxt, 1);;
if ((ctxt->value == ((void *)0)) || (ctxt->value->type != XPATH_NUMBER)) { xmlXPathErr(ctxt, XPATH_INVALID_TYPE); return; };
f = ctxt->value->floatval;
if ((f >= -0.5) && (f < 0.5)) {
ctxt->value->floatval *= 0.0;
}
else {
double rounded = floor(f);
if (f - rounded >= 0.5)
rounded += 1.0;
ctxt->value->floatval = rounded;
}
}
| {
"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": 2,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 3,
"union_type": 0,
"while_loop": 0
} |
nettle-3.9.1#base64-encode_prep#nettle_base64_encode_update.c | nettle-3.9.1 | base64-encode.c | nettle_base64_encode_update | 33 | size_t
nettle_base64_encode_update(struct base64_encode_ctx *ctx,
char *dst,
size_t length,
const uint8_t *src)
{
size_t done = 0;
size_t left = length;
unsigned left_over;
size_t bulk;
while (ctx->bits && left)
{
left--;
done += nettle_base64_encode_single(ctx, dst + done, *src++);
}
left_over = left % 3;
bulk = left - left_over;
if (bulk)
{
((void) sizeof ((!(bulk % 3)) ? 1 : 0), __extension__ ({ if (!(bulk % 3)) ; else __assert_fail ("!(bulk % 3)", "base64-encode.c", 161, __extension__ __PRETTY_FUNCTION__); }));
encode_raw(ctx->alphabet, dst + done, bulk, src);
done += ((((bulk) + 2)/3)*4);
src += bulk;
left = left_over;
}
while (left)
{
left--;
done += nettle_base64_encode_single(ctx, dst + done, *src++);
}
((void) sizeof ((done <= (((length) * 8 + 4)/6)) ? 1 : 0), __extension__ ({ if (done <= (((length) * 8 + 4)/6)) ; else __assert_fail ("done <= BASE64_ENCODE_LENGTH(length)", "base64-encode.c", 175, __extension__ __PRETTY_FUNCTION__); }));
return done;
}
| {
"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": 1,
"switch_statement": 0,
"type_casting": 2,
"union_type": 0,
"while_loop": 2
} |
tmux#vis_prep#strvisx.c | tmux | vis.c | strvisx | 14 | int
strvisx(char *dst, const char *src, size_t len, int flag)
{
char c;
char *start;
for (start = dst; len > 1; len--) {
c = *src;
dst = vis(dst, c, flag, *++src);
}
if (len)
dst = vis(dst, *src, flag, '\0');
*dst = '\0';
return (dst - start);
}
| {
"array_type": 0,
"break_continue_statement": 0,
"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": 0,
"union_type": 0,
"while_loop": 0
} |
json.h#allow_hexadecimal_numbers_prep#json_value_is_null.c | json.h | allow_hexadecimal_numbers.c | json_value_is_null | 3 | int json_value_is_null(const struct json_value_s *const value) {
return value->type == json_type_null;
}
| {
"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
} |
lodepng#lodepng_prep#lodepng_is_palette_type.c | lodepng | lodepng.c | lodepng_is_palette_type | 3 | unsigned lodepng_is_palette_type(const LodePNGColorMode* info) {
return info->colortype == LCT_PALETTE;
}
| {
"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#DYNAMIC_PROGRAMMING_SUBSET_SUM_PROBLEM_1_prep#max.c | transcoder-set | DYNAMIC_PROGRAMMING_SUBSET_SUM_PROBLEM_1.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
} |
patch-2.7.6#openat-proc_prep#openat_proc_name.c | patch-2.7.6 | openat-proc.c | openat_proc_name | 48 | char *
openat_proc_name (char buf[((4096) < (4096 - 64) ? (4096) : (4096 - 64))], int fd, char const *file)
{
char *result = buf;
int dirlen;
if (!*file)
{
buf[0] = '\0';
return buf;
}
{
enum {
PROC_SELF_FD_DIR_SIZE_BOUND
= (sizeof "/proc/self/fd/%d/" - (sizeof "%d" - 1)
+ (((((sizeof (int) * 8) - (! ((__typeof__ (int)) 0 < (__typeof__ (int)) -1))) * 146 + 484) / 485) + (! ((__typeof__ (int)) 0 < (__typeof__ (int)) -1))))
};
static int proc_status = 0;
if (! proc_status)
{
int proc_self_fd = open ("/proc/self/fd",
00 | 0200000 | 0400 | 04000);
if (proc_self_fd < 0)
proc_status = -1;
else
{
char dotdot_buf[PROC_SELF_FD_DIR_SIZE_BOUND + sizeof "../fd" - 1];
sprintf (dotdot_buf, "/proc/self/fd/%d/" "../fd", proc_self_fd);
proc_status = access (dotdot_buf, 0) ? -1 : 1;
close (proc_self_fd);
}
}
if (proc_status < 0)
return ((void *)0);
else
{
size_t bufsize = PROC_SELF_FD_DIR_SIZE_BOUND + strlen (file);
if (((4096) < (4096 - 64) ? (4096) : (4096 - 64)) < bufsize)
{
result = malloc (bufsize);
if (! result)
return ((void *)0);
}
dirlen = sprintf (result, "/proc/self/fd/%d/", fd);
}
}
strcpy (result + dirlen, file);
return result;
}
| {
"array_type": 1,
"break_continue_statement": 0,
"enum_type": 0,
"for_loop": 0,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 6,
"memory_management": 1,
"memory_operation": 0,
"pointer_type": 1,
"return_statement": 4,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 3,
"union_type": 0,
"while_loop": 0
} |
transcoder-set#COUNT_TRAILING_ZEROES_FACTORIAL_NUMBER_prep#f_gold.c | transcoder-set | COUNT_TRAILING_ZEROES_FACTORIAL_NUMBER.c | f_gold | 7 | int f_gold ( int n ) {
int count = 0;
for ( int i = 5;
n / i >= 1;
i *= 5 ) count += n / i;
return count;
}
| {
"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": 0,
"return_statement": 1,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 0,
"union_type": 0,
"while_loop": 0
} |
tulipindicators-0.9.1#msw_prep#ti_msw.c | tulipindicators-0.9.1 | msw.c | ti_msw | 36 | int ti_msw(int size, double const *const *inputs, double const *options, double *const *outputs) {
const double *input = inputs[0];
double *sine = outputs[0];
double *lead = outputs[1];
const int period = (int)options[0];
if (period < 1) return 1;
if (size <= ti_msw_start(options)) return 0;
const double pi = 3.1415926;
const double tpi = 2 * pi;
double weight = 0, phase;
double rp, ip;
int i, j;
for (i = period; i < size; ++i) {
rp = 0;
ip = 0;
for (j = 0; j < period; ++j) {
weight = input[i-j];
rp = rp + cos(tpi * j / period) * weight;
ip = ip + sin(tpi * j / period) * weight;
}
if (fabs(rp) > .001) {
phase = atan(ip/rp);
} else {
phase = tpi / 2.0 * (ip < 0 ? -1.0 : 1.0);
}
if (rp < 0.0) phase += pi;
phase += pi/2.0;
if (phase < 0.0) phase += tpi;
if (phase > tpi) phase -= tpi;
*sine++ = sin(phase);
*lead++ = sin(phase + pi/4.0);
}
((void) sizeof ((sine - outputs[0] == size - ti_msw_start(options)) ? 1 : 0), __extension__ ({ if (sine - outputs[0] == size - ti_msw_start(options)) ; else __assert_fail ("sine - outputs[0] == size - ti_msw_start(options)", "indicators/msw.c", 73, __extension__ __PRETTY_FUNCTION__); }));
((void) sizeof ((lead - outputs[1] == size - ti_msw_start(options)) ? 1 : 0), __extension__ ({ if (lead - outputs[1] == size - ti_msw_start(options)) ; else __assert_fail ("lead - outputs[1] == size - ti_msw_start(options)", "indicators/msw.c", 74, __extension__ __PRETTY_FUNCTION__); }));
return 0;
}
| {
"array_type": 3,
"break_continue_statement": 0,
"enum_type": 0,
"for_loop": 2,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 8,
"memory_management": 0,
"memory_operation": 0,
"pointer_type": 3,
"return_statement": 3,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 3,
"union_type": 0,
"while_loop": 0
} |
cflow-1.7#c_prep#yylex_destroy.c | cflow-1.7 | c.c | yylex_destroy | 12 | int yylex_destroy (void)
{
while(( (yy_buffer_stack) ? (yy_buffer_stack)[(yy_buffer_stack_top)] : ((void *)0))){
yy_delete_buffer(( (yy_buffer_stack) ? (yy_buffer_stack)[(yy_buffer_stack_top)] : ((void *)0)) );
(yy_buffer_stack)[(yy_buffer_stack_top)] = ((void *)0);
yypop_buffer_state();
}
yyfree((yy_buffer_stack) );
(yy_buffer_stack) = ((void *)0);
yy_init_globals( );
return 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": 5,
"union_type": 0,
"while_loop": 1
} |
transcoder-set#QUERIES_COUNTS_ARRAY_ELEMENTS_VALUES_GIVEN_RANGE_prep#f_filled.c | transcoder-set | QUERIES_COUNTS_ARRAY_ELEMENTS_VALUES_GIVEN_RANGE.c | f_filled | 1 | int f_filled ( int arr [ ], int n, int x, int 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": 0,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 0,
"union_type": 0,
"while_loop": 0
} |
libxml2#libxml2-py_prep#libxml_xmlFirstElementChild.c | libxml2 | libxml2-py.c | libxml_xmlFirstElementChild | 13 | PyObject *
libxml_xmlFirstElementChild(PyObject *self __attribute__ ((__unused__)), PyObject *args) {
PyObject *py_retval;
xmlNodePtr c_retval;
xmlNodePtr parent;
PyObject *pyobj_parent;
if (!_PyArg_ParseTuple_SizeT(args, (char *)"O:xmlFirstElementChild", &pyobj_parent))
return(((void *)0));
parent = (xmlNodePtr) (((pyobj_parent) == (&_Py_NoneStruct)) ? ((void *)0) : (((PyxmlNode_Object *)(pyobj_parent))->obj));
c_retval = xmlFirstElementChild(parent);
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": 2,
"return_statement": 2,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 3,
"union_type": 0,
"while_loop": 0
} |
transcoder-set#DYNAMIC_PROGRAMMING_HIGH_EFFORT_VS_LOW_EFFORT_TASKS_PROBLEM_prep#f_gold.c | transcoder-set | DYNAMIC_PROGRAMMING_HIGH_EFFORT_VS_LOW_EFFORT_TASKS_PROBLEM.c | f_gold | 4 | int f_gold ( int high [ ], int low [ ], int n ) {
if ( n <= 0 ) return 0;
return max ( high [ n - 1 ] + f_gold ( high, low, ( n - 2 ) ), low [ n - 1 ] + f_gold ( high, low, ( n - 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": 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.