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 |
|---|---|---|---|---|---|---|
libxml2#libxml2-py_prep#libxml_xmlUCSIsUnifiedCanadianAboriginalSyllabics.c | libxml2 | libxml2-py.c | libxml_xmlUCSIsUnifiedCanadianAboriginalSyllabics | 13 | PyObject *
libxml_xmlUCSIsUnifiedCanadianAboriginalSyllabics(PyObject *self __attribute__ ((__unused__)), PyObject *args) {
PyObject *py_retval;
int c_retval;
int code;
if (libxml_deprecationWarning("xmlUCSIsUnifiedCanadianAboriginalSyllabics") == -1)
return(((void *)0));
if (!_PyArg_ParseTuple_SizeT(args, (char *)"i:xmlUCSIsUnifiedCanadianAboriginalSyllabics", &code))
return(((void *)0));
c_retval = xmlUCSIsUnifiedCanadianAboriginalSyllabics(code);
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": 2,
"memory_management": 0,
"memory_operation": 0,
"pointer_type": 1,
"return_statement": 3,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 4,
"union_type": 0,
"while_loop": 0
} |
libxml2#libxml2-py_prep#libxml_xmlUCSIsBopomofo.c | libxml2 | libxml2-py.c | libxml_xmlUCSIsBopomofo | 13 | PyObject *
libxml_xmlUCSIsBopomofo(PyObject *self __attribute__ ((__unused__)), PyObject *args) {
PyObject *py_retval;
int c_retval;
int code;
if (libxml_deprecationWarning("xmlUCSIsBopomofo") == -1)
return(((void *)0));
if (!_PyArg_ParseTuple_SizeT(args, (char *)"i:xmlUCSIsBopomofo", &code))
return(((void *)0));
c_retval = xmlUCSIsBopomofo(code);
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": 2,
"memory_management": 0,
"memory_operation": 0,
"pointer_type": 1,
"return_statement": 3,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 4,
"union_type": 0,
"while_loop": 0
} |
screen-4.9.0#tty_prep#SetBaud.c | screen-4.9.0 | tty.c | SetBaud | 11 | int SetBaud(struct mode *m, int ibaud, int obaud)
{
struct baud_values *ip, *op;
if ((!(ip = lookup_baud(ibaud)) && ibaud != -1) || (!(op = lookup_baud(obaud)) && obaud != -1))
return -1;
if (ip)
cfsetispeed(&m->tio, ip->sym);
if (op)
cfsetospeed(&m->tio, op->sym);
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": 0,
"memory_operation": 0,
"pointer_type": 2,
"return_statement": 2,
"struct_type": 2,
"switch_statement": 0,
"type_casting": 0,
"union_type": 0,
"while_loop": 0
} |
nettle-3.9.1#cbc-aes256-encrypt_prep#_nettle_cbc_aes256_encrypt_c.c | nettle-3.9.1 | cbc-aes256-encrypt.c | _nettle_cbc_aes256_encrypt_c | 7 | void
_nettle_cbc_aes256_encrypt_c(const struct aes256_ctx *ctx, uint8_t *iv,
size_t length, uint8_t *dst, const uint8_t *src)
{
nettle_cbc_encrypt(ctx, (nettle_cipher_func *) nettle_aes256_encrypt,
16, iv, length, dst, src);
}
| {
"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
} |
transcoder-set#COUNT_SET_BITS_IN_AN_INTEGER_3_prep#main.c | transcoder-set | COUNT_SET_BITS_IN_AN_INTEGER_3.c | main | 14 | int main(void) {
int n_success = 0;
int param0[] = {6,58,90,69,15,54,60,51,46,91};
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
} |
gawk-5.2.2#grcat_prep#main.c | gawk-5.2.2 | grcat.c | main | 18 | int
main(int argc, char **argv)
{
struct group *g;
int i;
while ((g = getgrent()) != ((void *)0)) {
printf("%s:%s:%ld:", g->gr_name, g->gr_passwd,
(long) g->gr_gid);
for (i = 0; g->gr_mem[i] != ((void *)0); i++) {
printf("%s", g->gr_mem[i]);
if (g->gr_mem[i+1] != ((void *)0))
putchar(',');
}
putchar('\n');
}
endgrent();
return 0;
}
| {
"array_type": 1,
"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": 1,
"switch_statement": 0,
"type_casting": 4,
"union_type": 0,
"while_loop": 1
} |
gprolog-1.5.0#fd_inst_prep#Pl_Fd_Prolog_To_Array_Any.c | gprolog-1.5.0 | fd_inst.c | Pl_Fd_Prolog_To_Array_Any | 31 | WamWord *
Pl_Fd_Prolog_To_Array_Any(WamWord list_word)
{
WamWord word, tag_mask;
WamWord save_list_word;
WamWord *lst_adr;
int n = 0;
WamWord *array;
WamWord *save_array;
array = (((WamWordP *) pl_reg_bank)[256 +3]);
save_list_word = list_word;
save_array = array;
array++;
for (;;)
{
do { WamWord deref_last_word; word = list_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();
if (word == (((PlLong) (256) << 3) + ((PlULong)0x3)))
break;
if (tag_mask != (PlULong)0x1)
Pl_Err_Type(pl_type_list, save_list_word);
lst_adr = ((WamWord *) ((word) & (PlULong)0xfffffffffffffff8));
*array++ = (((WamWord *) lst_adr)[0]);
n++;
list_word = (((WamWord *) lst_adr)[0 +1]);
}
*save_array = n;
(((WamWordP *) pl_reg_bank)[256 +3]) = array;
return save_array;
}
| {
"array_type": 0,
"break_continue_statement": 2,
"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": 1,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 0,
"union_type": 0,
"while_loop": 1
} |
tar-1.34#backupfile_prep#set_simple_backup_suffix.c | tar-1.34 | backupfile.c | set_simple_backup_suffix | 7 | void
set_simple_backup_suffix (char const *s)
{
if (!s)
s = getenv ("SIMPLE_BACKUP_SUFFIX");
simple_backup_suffix = s && *s && s == last_component (s) ? s : "~";
}
| {
"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
} |
transcoder-set#FIND_NUMBER_PAIRS_ARRAY_XOR_0_prep#f_gold.c | transcoder-set | FIND_NUMBER_PAIRS_ARRAY_XOR_0.c | f_gold | 18 | int f_gold ( int a [ ], int n ) {
sort ( a, a + n );
int count = 1;
int answer = 0;
for ( int i = 1;
i < n;
i ++ ) {
if ( a [ i ] == a [ i - 1 ] ) {
count += 1;
}
else {
answer = answer + ( count * ( count - 1 ) ) / 2;
count = 1;
}
}
answer = answer + ( count * ( count - 1 ) ) / 2;
return answer;
}
| {
"array_type": 1,
"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": 1,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 0,
"union_type": 0,
"while_loop": 0
} |
mtools-4.0.43#directory_prep#dir_grow.c | mtools-4.0.43 | directory.c | dir_grow | 21 | int dir_grow(Stream_t *Dir, unsigned int size)
{
Stream_t *Stream = GetFs(Dir);
Fs_t *This = (Fs_t *) Stream;
ssize_t ret;
unsigned int buflen;
char *buffer;
if (!getfreeMinClusters(Dir, 1))
return -1;
buflen = getClusterBytes(This);
if(! (buffer=malloc(buflen)) ){
perror("dir_grow: malloc");
return -1;
}
memset((char *) buffer, '\0', buflen);
ret = force_pwrite(Dir, buffer, (mt_off_t) size * 32, buflen);
free(buffer);
if(ret < (int) buflen)
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": 3,
"memory_management": 2,
"memory_operation": 1,
"pointer_type": 3,
"return_statement": 4,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 2,
"union_type": 0,
"while_loop": 0
} |
tar-1.34#mbrtowc_prep#rpl_mbrtowc.c | tar-1.34 | mbrtowc.c | rpl_mbrtowc | 16 | size_t
rpl_mbrtowc (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps)
{
size_t ret;
wchar_t wc;
if (! pwc)
pwc = &wc;
ret = mbrtowc (pwc, s, n, ps);
if ((size_t) -2 <= ret && n != 0 && ! hard_locale (0))
{
unsigned char uc = *s;
*pwc = uc;
return 1;
}
return ret;
}
| {
"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
} |
mcsim-6.2.0#random_prep#GenLogNormalRandom.c | mcsim-6.2.0 | random.c | GenLogNormalRandom | 23 | double GenLogNormalRandom (double dMean, double dSDNorm,
double dSDLogNorm)
{
double dmuz, dSLogNorm, dLambda, dz;
if (dMean < 0) {
char str[10];
sprintf(str, "%5.2e", dMean);
ReportRunTimeError(((void *)0), 0x0303 | 0x8000,
"", str, "GenLogNormalRandom");
}
else
if (dSDLogNorm <= 0) {
char str[10];
sprintf(str, "%5.2e", dSDLogNorm);
ReportRunTimeError(((void *)0), 0x0302 | 0x8000,
"", str, "GenLogNormalRandom");
}
dSLogNorm = sqrt(exp(pow(dSDLogNorm,2)) * (exp(pow(dSDLogNorm,2)) - 1));
dLambda = pow(dSDNorm/dSLogNorm,2);
dmuz = log(dMean + sqrt(pow(dMean,2) + dLambda));
dz = NormalRandom(dmuz, dSLogNorm);
return (exp(dz) - dLambda * exp(-dz))/2;
}
| {
"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": 2,
"union_type": 0,
"while_loop": 0
} |
pexec-1.0rc8#iof_prep#freadline.c | pexec-1.0rc8 | iof.c | freadline | 15 | char *freadline(FILE *fr)
{
char *ret,buff[256];
ret=((void *)0);
if ( feof(fr) ) return(((void *)0));
while ( 1 )
{ if ( fgets(buff,255,fr)==((void *)0) ) break;
if ( ret==((void *)0) ) ret=(char *)malloc(strlen(buff)+1),ret[0]=0;
else ret=(char *)realloc(ret,strlen(ret)+strlen(buff)+1);
do { if ( ret==((void *)0) && 1>0 ) { fprintf(stderr,"iof.c: %s.\n","memory exhausted"); abort(); } } while(0);
strcat(ret,buff);
if ( ret[strlen(ret)-1]==10 ) break;
}
return(ret);
}
| {
"array_type": 2,
"break_continue_statement": 2,
"enum_type": 0,
"for_loop": 0,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 5,
"memory_management": 2,
"memory_operation": 0,
"pointer_type": 1,
"return_statement": 2,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 6,
"union_type": 0,
"while_loop": 2
} |
libxml2#xmlwriter_prep#xmlTextWriterWriteDTDAttlist.c | libxml2 | xmlwriter.c | xmlTextWriterWriteDTDAttlist | 23 | int
xmlTextWriterWriteDTDAttlist(xmlTextWriterPtr writer,
const xmlChar * name, const xmlChar * content)
{
int count;
int sum;
if (content == ((void *)0))
return -1;
sum = 0;
count = xmlTextWriterStartDTDAttlist(writer, name);
if (count == -1)
return -1;
sum += count;
count = xmlTextWriterWriteString(writer, content);
if (count == -1)
return -1;
sum += count;
count = xmlTextWriterEndDTDAttlist(writer);
if (count == -1)
return -1;
sum += count;
return sum;
}
| {
"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": 1,
"union_type": 0,
"while_loop": 0
} |
tulipindicators-0.9.1#exp_prep#ti_exp.c | tulipindicators-0.9.1 | exp.c | ti_exp | 1 | int ti_exp(int size, double const *const *inputs, double const *options, double *const *outputs) { const double *in1 = inputs[0]; (void)options; double *output = outputs[0]; int i; for (i = 0; i < size; ++i) { output[i] = (exp(in1[i])); } return 0; }
| {
"array_type": 4,
"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": 3,
"return_statement": 1,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 1,
"union_type": 0,
"while_loop": 0
} |
tar-1.34#system_prep#sys_write_archive_buffer.c | tar-1.34 | system.c | sys_write_archive_buffer | 5 | size_t
sys_write_archive_buffer (void)
{
return (((archive) >= (1 << 30)) ? rmt_write__ (archive - (1 << 30), record_start->buffer, record_size) : full_write (archive, record_start->buffer, record_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": 1,
"union_type": 0,
"while_loop": 0
} |
mcsim-6.2.0#mh_prep#MaxMCVar.c | mcsim-6.2.0 | mh.c | MaxMCVar | 14 | double MaxMCVar (PMCVAR pMCVar)
{
if (pMCVar->iType == 8 || pMCVar->iType == 12 ) {
return( *(pMCVar->pdParm[3]));
}
else {
if (pMCVar->iType == 0 || pMCVar->iType == 1 ) {
return( *(pMCVar->pdParm[1]));
}
else {
return( *(pMCVar->pdParm[3]));
}
}
}
| {
"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": 3,
"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#f_gold.c | transcoder-set | MINIMUM_STEPS_TO_DELETE_A_STRING_AFTER_REPEATED_DELETION_OF_PALINDROME_SUBSTRINGS.c | f_gold | 26 | int f_gold ( char str [] ) {
int N = strlen(str);
int dp [ N + 1 ] [ N + 1 ];
for ( int i = 0;
i <= N;
i ++ ) for ( int j = 0;
j <= N;
j ++ ) dp [ i ] [ j ] = 0;
for ( int len = 1;
len <= N;
len ++ ) {
for ( int i = 0, j = len - 1;
j < N;
i ++, j ++ ) {
if ( len == 1 ) dp [ i ] [ j ] = 1;
else {
dp [ i ] [ j ] = 1 + dp [ i + 1 ] [ j ];
if ( str [ i ] == str [ i + 1 ] ) dp [ i ] [ j ] = min ( 1 + dp [ i + 2 ] [ j ], dp [ i ] [ j ] );
for ( int K = i + 2;
K <= j;
K ++ ) if ( str [ i ] == str [ K ] ) dp [ i ] [ j ] = min ( dp [ i + 1 ] [ K - 1 ] + dp [ K + 1 ] [ j ], dp [ i ] [ j ] );
}
}
}
return dp [ 0 ] [ N - 1 ];
}
| {
"array_type": 2,
"break_continue_statement": 0,
"enum_type": 0,
"for_loop": 5,
"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": 0
} |
transcoder-set#CALCULATE_AREA_TETRAHEDRON_prep#len.c | transcoder-set | CALCULATE_AREA_TETRAHEDRON.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#FIND_N_TH_ELEMENT_FROM_STERNS_DIATOMIC_SERIES_prep#f_gold.c | transcoder-set | FIND_N_TH_ELEMENT_FROM_STERNS_DIATOMIC_SERIES.c | f_gold | 12 | int f_gold ( int n ) {
int DP [ n + 1 ];
DP [ 0 ] = 0;
DP [ 1 ] = 1;
for ( int i = 2;
i <= n;
i ++ ) {
if ( i % 2 == 0 ) DP [ i ] = DP [ i / 2 ];
else DP [ i ] = DP [ ( i - 1 ) / 2 ] + DP [ ( i + 1 ) / 2 ];
}
return DP [ n ];
}
| {
"array_type": 1,
"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": 1,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 0,
"union_type": 0,
"while_loop": 0
} |
nettle-3.9.1#cast128_prep#nettle_cast128_set_key.c | nettle-3.9.1 | cast128.c | nettle_cast128_set_key | 5 | void
nettle_cast128_set_key(struct cast128_ctx *ctx, const uint8_t *key)
{
nettle_cast5_set_key (ctx, 16, key);
}
| {
"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
} |
uucp-1.07#protj_prep#fjshutdown.c | uucp-1.07 | protj.c | fjshutdown | 10 | boolean
fjshutdown (qdaemon)
struct sdaemon *qdaemon;
{
boolean fret;
fret = fishutdown (qdaemon);
ubuffree (zJavoid);
ubuffree (zJbuf);
return fret;
}
| {
"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
} |
less-633#screen_prep#lower_left.c | less-633 | screen.c | lower_left | 5 | void lower_left(void)
{
assert_interactive();
ltputs(sc_lower_left, 1, putchr);
}
| {
"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
} |
dap-3.10#prob_prep#probt.c | dap-3.10 | prob.c | probt | 16 | double probt(double t1, int di)
{
double c;
double ddi;
if (!finite(t1))
return 0.0 / 0.0;
ddi = (double) di;
dddi = ddi;
for (c = 1.0; ddi > 2.0; ddi -= 2.0)
c *= (ddi - 1.0) / (ddi - 2.0);
if (ddi == 2.0)
c *= 0.5;
else
c /= 3.14159265358979323846;
return c * dap_simp(&Tfun, atan(t1 / sqrt(dddi)), 1.57079632679489661923, 1024);
}
| {
"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": 0,
"return_statement": 2,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 1,
"union_type": 0,
"while_loop": 0
} |
units-2.22#units_prep#getuser_readline.c | units-2.22 | units.c | getuser_readline | 21 | void
getuser_readline(char **buffer, int *bufsize, const char *query)
{
int valid = 0;
while (!valid){
if (*buffer) free(*buffer);
*buffer = readline(query);
if (*buffer)
replacectrlchars(*buffer);
if (!*buffer || strwidth(*buffer)>=0)
valid=1;
else
printf("Error: %s\n",invalid_utf8);
}
if (((*buffer) && *(*buffer))) add_history(*buffer);
if (!*buffer){
if (!flags.quiet)
putchar('\n');
exit(0);
}
}
| {
"array_type": 0,
"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": 0,
"return_statement": 0,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 0,
"union_type": 0,
"while_loop": 1
} |
libxml2#xmlsave_prep#xmlDocDump.c | libxml2 | xmlsave.c | xmlDocDump | 4 | int
xmlDocDump(FILE *f, xmlDocPtr cur) {
return(xmlDocFormatDump (f, cur, 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
} |
genann#genann_prep#genann_act_sigmoid_cached.c | genann | genann.c | genann_act_sigmoid_cached | 8 | double genann_act_sigmoid_cached(const genann *ann __attribute__((unused)), double a) {
((void) sizeof ((!__builtin_isnan (a)) ? 1 : 0), __extension__ ({ if (!__builtin_isnan (a)) ; else __assert_fail ("!isnan(a)", "genann.c", 87, __extension__ __PRETTY_FUNCTION__); }));
if (a < sigmoid_dom_min) return lookup[0];
if (a >= sigmoid_dom_max) return lookup[4096 - 1];
size_t j = (size_t)((a-sigmoid_dom_min)*interval+0.5);
if (__builtin_expect(!!(j >= 4096), 0)) return lookup[4096 - 1];
return lookup[j];
}
| {
"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": 4,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 2,
"union_type": 0,
"while_loop": 0
} |
transcoder-set#MINIMUM_SUM_TWO_NUMBERS_FORMED_DIGITS_ARRAY_2_prep#cmpfunc.c | transcoder-set | MINIMUM_SUM_TWO_NUMBERS_FORMED_DIGITS_ARRAY_2.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
} |
rcs-5.10.1#b-peer_prep#one_beyond_last_dir_sep.c | rcs-5.10.1 | b-peer.c | one_beyond_last_dir_sep | 8 | const char *
one_beyond_last_dir_sep (const char *name)
{
const char *end = strrchr (name, '/');
return end
? 1 + end
: ((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": 1,
"return_statement": 1,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 1,
"union_type": 0,
"while_loop": 0
} |
tinycc#tccpp_prep#end_macro.c | tinycc | tccpp.c | end_macro | 12 | void end_macro(void)
{
TokenString *str = macro_stack;
macro_stack = str->prev;
macro_ptr = str->prev_ptr;
file->line_num = str->save_line_num;
if (str->alloc == 2) {
str->alloc = 3;
} else {
tok_str_free(str);
}
}
| {
"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": 0,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 1,
"union_type": 0,
"while_loop": 0
} |
nettle-3.9.1#base64-encode_prep#nettle_base64_encode_final.c | nettle-3.9.1 | base64-encode.c | nettle_base64_encode_final | 16 | size_t
nettle_base64_encode_final(struct base64_encode_ctx *ctx,
char *dst)
{
unsigned done = 0;
unsigned bits = ctx->bits;
if (bits)
{
dst[done++] = ((ctx->alphabet)[0x3F & ((ctx->word << (6 - ctx->bits)))]);
for (; bits < 6; bits += 2)
dst[done++] = '=';
ctx->bits = 0;
}
((void) sizeof ((done <= 3) ? 1 : 0), __extension__ ({ if (done <= 3) ; else __assert_fail ("done <= BASE64_ENCODE_FINAL_LENGTH", "base64-encode.c", 198, __extension__ __PRETTY_FUNCTION__); }));
return done;
}
| {
"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": 0,
"return_statement": 1,
"struct_type": 1,
"switch_statement": 0,
"type_casting": 1,
"union_type": 0,
"while_loop": 0
} |
libxml2#libxml2-py_prep#libxml_xmlSchemaCleanupTypes.c | libxml2 | libxml2-py.c | libxml_xmlSchemaCleanupTypes | 8 | PyObject *
libxml_xmlSchemaCleanupTypes(PyObject *self __attribute__ ((__unused__)), PyObject *args __attribute__ ((__unused__))) {
if (libxml_deprecationWarning("xmlSchemaCleanupTypes") == -1)
return(((void *)0));
xmlSchemaCleanupTypes();
_Py_INCREF(((PyObject*)((&_Py_NoneStruct))));
return((&_Py_NoneStruct));
}
| {
"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
} |
tinycc#x86_64-gen_prep#ggoto.c | tinycc | x86_64-gen.c | ggoto | 5 | void ggoto(void)
{
gcall_or_jmp(1);
vtop--;
}
| {
"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#ADD_1_TO_A_GIVEN_NUMBER_prep#cmpfunc.c | transcoder-set | ADD_1_TO_A_GIVEN_NUMBER.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
} |
findutils-4.9.0#frcode_prep#main.c | findutils-4.9.0 | frcode.c | main | 122 | int
main (int argc, char **argv)
{
char *path;
char *oldpath;
size_t pathsize, oldpathsize;
int count, oldcount, diffcount;
int line_len;
int delimiter = '\n';
int optc;
int slocate_compat = 0;
long slocate_seclevel = 0L;
if (argv[0])
set_program_name (argv[0]);
else
set_program_name ("frcode");
if (atexit (close_stdout))
{
((!!sizeof (struct { _Static_assert (1, "verify_expr (" "1" ", " "(error (1, (*__errno_location ()), gettext (\"The atexit library function failed\")), assume (false))" ")"); int _gl_dummy; })) ? ((error (1, (*__errno_location ()), gettext ("The atexit library function failed")), ((0) ? (void) 0 : __builtin_unreachable ()))) : ((error (1, (*__errno_location ()), gettext ("The atexit library function failed")), ((0) ? (void) 0 : __builtin_unreachable ()))));
}
pathsize = oldpathsize = 1026;
path = xmalloc (pathsize);
oldpath = xmalloc (oldpathsize);
oldpath[0] = 0;
oldcount = 0;
while ((optc = getopt_long (argc, argv, "hv0S:", longopts, (int *) 0)) != -1)
switch (optc)
{
case '0':
delimiter = 0;
break;
case 'S':
slocate_compat = 1;
slocate_seclevel = get_seclevel (optarg);
if (slocate_seclevel < 0 || slocate_seclevel > 1)
{
((!!sizeof (struct { _Static_assert (1, "verify_expr (" "1" ", " "(error (1, 0, gettext (\"slocate security level %ld is unsupported.\"), slocate_seclevel), assume (false))" ")"); int _gl_dummy; })) ? ((error (1, 0, gettext ("slocate security level %ld is unsupported."), slocate_seclevel), ((0) ? (void) 0 : __builtin_unreachable ()))) : ((error (1, 0, gettext ("slocate security level %ld is unsupported."), slocate_seclevel), ((0) ? (void) 0 : __builtin_unreachable ()))));
}
break;
case 'h':
usage (0);
case 'v':
display_findutils_version ("frcode");
return 0;
default:
usage (1);
}
if (optind != argc)
{
error (0, 0, gettext ("no argument expected."));
usage (1);
}
if (slocate_compat)
{
fputc (slocate_seclevel ? '1' : '0', stdout);
fputc (0, stdout);
}
else
{
if (fwrite ("\0LOCATE02", 1, sizeof ("\0LOCATE02"), stdout)
!= sizeof ("\0LOCATE02"))
{
((!!sizeof (struct { _Static_assert (1, "verify_expr (" "1" ", " "(error (1, (*__errno_location ()), gettext (\"Failed to write to standard output\")), assume (false))" ")"); int _gl_dummy; })) ? ((error (1, (*__errno_location ()), gettext ("Failed to write to standard output")), ((0) ? (void) 0 : __builtin_unreachable ()))) : ((error (1, (*__errno_location ()), gettext ("Failed to write to standard output")), ((0) ? (void) 0 : __builtin_unreachable ()))));
}
}
while ((line_len = getdelim (&path, &pathsize, delimiter, stdin)) > 0)
{
if (path[line_len - 1] != delimiter)
{
error (0, 0, gettext ("The input file should end with the delimiter"));
}
else
{
path[line_len - 1] = '\0';
}
count = prefix_length (oldpath, path);
diffcount = count - oldcount;
if ( (diffcount > 0x7fff) || (diffcount < (-0x7fff - 1)) )
{
count = 0;
diffcount = (-oldcount);
}
oldcount = count;
if (slocate_compat)
{
slocate_compat = 0;
}
else
{
if (diffcount < (-127)
|| diffcount > (127))
{
if ((-1) == putc (0x80, stdout))
outerr ();
if (!put_short (diffcount, stdout))
outerr ();
}
else
{
if ((-1) == putc (diffcount, stdout))
outerr ();
}
}
if ( ((-1) == fputs (path + count, stdout))
|| ((-1) == putc ('\0', stdout)))
{
outerr ();
}
if (1)
{
char *tmppath = oldpath;
size_t tmppathsize = oldpathsize;
oldpath = path;
oldpathsize = pathsize;
path = tmppath;
pathsize = tmppathsize;
}
}
free (path);
free (oldpath);
return 0;
}
| {
"array_type": 2,
"break_continue_statement": 2,
"enum_type": 0,
"for_loop": 0,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 15,
"memory_management": 2,
"memory_operation": 0,
"pointer_type": 3,
"return_statement": 2,
"struct_type": 0,
"switch_statement": 1,
"type_casting": 4,
"union_type": 0,
"while_loop": 2
} |
rcs-5.10.1#b-anchor_prep#recognize_keyword.c | rcs-5.10.1 | b-anchor.c | recognize_keyword | 14 | _Bool
recognize_keyword (char const *string, struct pool_found *found)
{
const char delims[3] = { '$', ':', '\0' };
size_t limit = strcspn (string, delims);
const struct cbuf x =
{
.string = string,
.size = limit
};
return (('$' == string[limit]
|| ':' == string[limit])
&& pool_lookup (keyword_pool, &x, found));
}
| {
"array_type": 2,
"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
} |
gprolog-1.5.0#c_supp_prep#Pl_Check_For_Un_Codes.c | gprolog-1.5.0 | c_supp.c | Pl_Check_For_Un_Codes | 19 | void
Pl_Check_For_Un_Codes(WamWord start_word)
{
WamWord word, tag_mask;
WamWord save_start_word;
WamWord *lst_adr;
save_start_word = start_word;
for (;;)
{
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 || word == (((PlLong) (256) << 3) + ((PlULong)0x3)))
return;
if (tag_mask != (PlULong)0x1)
Pl_Err_Type(pl_type_list, save_start_word);
lst_adr = ((WamWord *) ((word) & (PlULong)0xfffffffffffffff8));
Pl_Check_For_Un_Code((((WamWord *) lst_adr)[0]));
start_word = (((WamWord *) lst_adr)[0 +1]);
}
}
| {
"array_type": 0,
"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": 1,
"return_statement": 1,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 0,
"union_type": 0,
"while_loop": 1
} |
snudown#buffer_prep#bufcstr.c | snudown | buffer.c | bufcstr | 12 | const char *
bufcstr(struct buf *buf)
{
((void) sizeof ((buf && buf->unit) ? 1 : 0), __extension__ ({ if (buf && buf->unit) ; else __assert_fail ("buf && buf->unit", "buffer.c", 94, __extension__ __PRETTY_FUNCTION__); }));
if (buf->size < buf->asize && buf->data[buf->size] == 0)
return (char *)buf->data;
if (buf->size + 1 <= buf->asize || bufgrow(buf, buf->size + 1) == 0) {
buf->data[buf->size] = 0;
return (char *)buf->data;
}
return ((void *)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": 3,
"struct_type": 1,
"switch_statement": 0,
"type_casting": 4,
"union_type": 0,
"while_loop": 0
} |
heman#mat3_prep#kmMat3Identity.c | heman | mat3.c | kmMat3Identity | 6 | kmMat3* kmMat3Identity(kmMat3* pOut)
{
memset(pOut->mat, 0, sizeof(float) * 9);
pOut->mat[0] = pOut->mat[4] = pOut->mat[8] = 1.0f;
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": 1,
"pointer_type": 0,
"return_statement": 1,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 1,
"union_type": 0,
"while_loop": 0
} |
transcoder-set#FIND_SUM_EVEN_FACTORS_NUMBER_prep#f_gold.c | transcoder-set | FIND_SUM_EVEN_FACTORS_NUMBER.c | f_gold | 19 | int f_gold ( int n ) {
if ( n % 2 != 0 ) return 0;
int res = 1;
for ( int i = 2;
i <= sqrt ( n );
i ++ ) {
int count = 0, curr_sum = 1, curr_term = 1;
while ( n % i == 0 ) {
count ++;
n = n / i;
if ( i == 2 && count == 1 ) curr_sum = 0;
curr_term *= i;
curr_sum += curr_term;
}
res *= curr_sum;
}
if ( n >= 2 ) res *= ( 1 + n );
return res;
}
| {
"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": 2,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 0,
"union_type": 0,
"while_loop": 1
} |
binn-3.0#binn_prep#binn_object_object.c | binn-3.0 | binn.c | binn_object_object | 5 | void * binn_object_object(void *obj, const char *key) {
void *value;
binn_object_get(obj, key, 0xE2, &value, ((void *)0));
return value;
}
| {
"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": 1,
"union_type": 0,
"while_loop": 0
} |
json.h#allow_multi_line_strings_prep#json_write_number.c | json.h | allow_multi_line_strings.c | json_write_number | 115 | char *json_write_number(const struct json_number_s *number, char *data) {
uintmax_t parsed_number, backup;
size_t i;
if (number->number_size >= 2) {
switch (number->number[1]) {
default:
break;
case 'x':
case 'X':
parsed_number = strtoumax(number->number, 0, 0);
backup = parsed_number;
i = 0;
while (0 != parsed_number) {
parsed_number /= 10;
i++;
}
parsed_number = backup;
backup = i;
do {
*(data + i - 1) = '0' + (char)(parsed_number % 10);
parsed_number /= 10;
i--;
} while (0 != parsed_number);
data += backup;
return data;
}
}
i = 0;
if ((i < number->number_size) &&
(('+' == number->number[i]) || ('-' == number->number[i]))) {
i++;
}
if ((i < number->number_size) && ('I' == number->number[i])) {
const char *inf = "Infinity";
size_t k;
for (k = i; k < number->number_size; k++) {
const char c = *inf++;
if ('\0' == c) {
break;
} else if (c != number->number[k]) {
break;
}
}
if ('\0' == *inf++) {
const char *dbl_max;
if ('-' == number->number[0]) {
*data++ = '-';
}
for (dbl_max = "1.7976931348623158e308"; '\0' != *dbl_max; dbl_max++) {
*data++ = *dbl_max;
}
return data;
}
}
if ((i < number->number_size) && ('N' == number->number[i])) {
const char *nan = "NaN";
size_t k;
for (k = i; k < number->number_size; k++) {
const char c = *nan++;
if ('\0' == c) {
break;
} else if (c != number->number[k]) {
break;
}
}
if ('\0' == *nan++) {
*data++ = '0';
return data;
}
}
if ((i < number->number_size) && ('.' == number->number[i])) {
i = 0;
if ('+' == number->number[i]) {
i++;
}
if ('-' == number->number[i]) {
*data++ = '-';
i++;
}
*data++ = '0';
for (; i < number->number_size; i++) {
*data++ = number->number[i];
}
return data;
}
for (; i < number->number_size; i++) {
const char c = number->number[i];
if (!('0' <= c && c <= '9')) {
break;
}
}
if ((i + 1 == number->number_size) && ('.' == number->number[i])) {
i = 0;
if ('+' == number->number[i]) {
i++;
}
if ('-' == number->number[i]) {
*data++ = '-';
i++;
}
for (; i < number->number_size; i++) {
*data++ = number->number[i];
}
*data++ = '0';
return data;
}
i = 0;
if ('+' == number->number[i]) {
i++;
}
for (; i < number->number_size; i++) {
*data++ = number->number[i];
}
return data;
}
| {
"array_type": 1,
"break_continue_statement": 6,
"enum_type": 0,
"for_loop": 7,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 19,
"memory_management": 0,
"memory_operation": 0,
"pointer_type": 3,
"return_statement": 6,
"struct_type": 1,
"switch_statement": 1,
"type_casting": 1,
"union_type": 0,
"while_loop": 2
} |
optipng-0.7.8#ioutil_prep#opng_os_unlink.c | optipng-0.7.8 | ioutil.c | opng_os_unlink | 5 | int
opng_os_unlink(const char *path)
{
return unlink(path);
}
| {
"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#valid_prep#xmlDumpElementTable.c | libxml2 | valid.c | xmlDumpElementTable | 10 | void
xmlDumpElementTable(xmlBufferPtr buf, xmlElementTablePtr table) {
xmlSaveCtxtPtr save;
if ((buf == ((void *)0)) || (table == ((void *)0)))
return;
save = xmlSaveToBuffer(buf, ((void *)0), 0);
xmlHashScan(table, xmlDumpElementDeclScan, save);
if (xmlSaveFinish(save) != XML_ERR_OK)
xmlFree(xmlBufferDetach(buf));
}
| {
"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": 2,
"union_type": 0,
"while_loop": 0
} |
ht#ht_prep#ht_create.c | ht | ht.c | ht_create | 14 | ht* ht_create(void) {
ht* table = malloc(sizeof(ht));
if (table == ((void *)0)) {
return ((void *)0);
}
table->length = 0;
table->capacity = 16;
table->entries = calloc(table->capacity, sizeof(ht_entry));
if (table->entries == ((void *)0)) {
free(table);
return ((void *)0);
}
return table;
}
| {
"array_type": 0,
"break_continue_statement": 0,
"enum_type": 0,
"for_loop": 0,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 2,
"memory_management": 3,
"memory_operation": 0,
"pointer_type": 0,
"return_statement": 3,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 5,
"union_type": 0,
"while_loop": 0
} |
tar-1.34#xheader_prep#xheader_format_name.c | tar-1.34 | xheader.c | xheader_format_name | 99 | char *
xheader_format_name (struct tar_stat_info *st, const char *fmt, size_t n)
{
char *buf;
size_t len;
char *q;
const char *p;
char *dirp = ((void *)0);
char *dir = ((void *)0);
char *base = ((void *)0);
char pidbuf[((((((sizeof (uintmax_t) * 8) - (! ((__typeof__ (uintmax_t)) 0 < (__typeof__ (uintmax_t)) -1))) * 146 + 484) / 485) + (! ((__typeof__ (uintmax_t)) 0 < (__typeof__ (uintmax_t)) -1))) + 1)];
char const *pptr = ((void *)0);
char nbuf[((((((sizeof (uintmax_t) * 8) - (! ((__typeof__ (uintmax_t)) 0 < (__typeof__ (uintmax_t)) -1))) * 146 + 484) / 485) + (! ((__typeof__ (uintmax_t)) 0 < (__typeof__ (uintmax_t)) -1))) + 1)];
char const *nptr = ((void *)0);
len = 0;
for (p = fmt; *p; p++)
{
if (*p == '%' && p[1])
{
switch (*++p)
{
case '%':
len++;
break;
case 'd':
if (st)
{
if (!dirp)
dirp = dir_name (st->orig_file_name);
dir = safer_name_suffix (dirp, 0, absolute_names_option);
len += strlen (dir);
}
break;
case 'f':
if (st)
{
base = last_component (st->orig_file_name);
len += strlen (base);
}
break;
case 'p':
pptr = umaxtostr (getpid (), pidbuf);
len += pidbuf + sizeof pidbuf - 1 - pptr;
break;
case 'n':
nptr = umaxtostr (n, nbuf);
len += nbuf + sizeof nbuf - 1 - nptr;
break;
default:
len += 2;
}
}
else
len++;
}
buf = xmalloc (len + 1);
for (q = buf, p = fmt; *p; )
{
if (*p == '%')
{
switch (p[1])
{
case '%':
*q++ = *p++;
p++;
break;
case 'd':
if (dir)
q = stpcpy (q, dir);
p += 2;
break;
case 'f':
if (base)
q = stpcpy (q, base);
p += 2;
break;
case 'p':
q = stpcpy (q, pptr);
p += 2;
break;
case 'n':
q = stpcpy (q, nptr);
p += 2;
break;
default:
*q++ = *p++;
if (*p)
*q++ = *p++;
}
}
else
*q++ = *p++;
}
free (dirp);
while (q > buf && ((q[-1]) == '/'))
q--;
*q = 0;
return buf;
}
| {
"array_type": 1,
"break_continue_statement": 10,
"enum_type": 0,
"for_loop": 2,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 8,
"memory_management": 1,
"memory_operation": 0,
"pointer_type": 8,
"return_statement": 1,
"struct_type": 1,
"switch_statement": 2,
"type_casting": 5,
"union_type": 0,
"while_loop": 1
} |
tulipindicators-0.9.1#tiamalgamation_prep#ti_cvi.c | tulipindicators-0.9.1 | tiamalgamation.c | ti_cvi | 25 | int ti_cvi(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 < 1) return 1;
if (size <= ti_cvi_start(options)) return 0;
const double per = 2 / ((double)period + 1);
ti_buffer *lag = ti_buffer_new(period);
double val = high[0]-low[0];
int i;
for (i = 1; i < period*2-1; ++i) {
val = ((high[i]-low[i])-val) * per + val;
do { (lag)->vals[(lag)->index] = (val); (lag)->index = ((lag)->index + 1); if ((lag)->index >= (lag)->size) (lag)->index = 0; } while (0);
}
for (i = period*2-1; i < size; ++i) {
val = ((high[i]-low[i])-val) * per + val;
const double old = lag->vals[lag->index];
*output++ = 100.0 * (val - old) / old;
do { (lag)->vals[(lag)->index] = (val); (lag)->index = ((lag)->index + 1); if ((lag)->index >= (lag)->size) (lag)->index = 0; } while (0);
}
ti_buffer_free(lag);
((void) sizeof ((output - outputs[0] == size - ti_cvi_start(options)) ? 1 : 0), __extension__ ({ if (output - outputs[0] == size - ti_cvi_start(options)) ; else __assert_fail ("output - outputs[0] == size - ti_cvi_start(options)", "tiamalgamation.c", 2199, __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": 5,
"memory_management": 0,
"memory_operation": 0,
"pointer_type": 4,
"return_statement": 3,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 3,
"union_type": 0,
"while_loop": 2
} |
nano-7.2#utils_prep#tail.c | nano-7.2 | utils.c | tail | 8 | const char *tail(const char *path)
{
const char *slash = strrchr(path, '/');
if (slash == ((void *)0))
return path;
else
return slash + 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": 1,
"return_statement": 2,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 1,
"union_type": 0,
"while_loop": 0
} |
indent-2.2.13#parse_prep#parse.c | indent-2.2.13 | parse.c | parse | 177 | extern exit_values_ty parse (
codes_ty tk)
{
int i;
while ((parser_state_tos->p_stack[parser_state_tos->tos] == ifhead) &&
(tk != elselit))
{
parser_state_tos->p_stack[parser_state_tos->tos] = stmt;
reduce ();
}
switch (tk)
{
case decl:
parser_state_tos->search_brace = settings.braces_on_struct_decl_line;
if ((parser_state_tos->p_stack[parser_state_tos->tos] != decl) &&
(parser_state_tos->block_init == 0))
{
break_comma = 1;
inc_pstack ();
parser_state_tos->p_stack[parser_state_tos->tos] = decl;
parser_state_tos->il[parser_state_tos->tos] = parser_state_tos->i_l_follow;
if (settings.ljust_decl)
{
parser_state_tos->ind_level = 0;
for (i = parser_state_tos->tos - 1; i > 0; --i)
{
if (parser_state_tos->p_stack[i] == decl)
{
parser_state_tos->ind_level += settings.ind_size;
}
}
parser_state_tos->i_l_follow = parser_state_tos->ind_level;
}
}
break;
case ifstmt:
if (parser_state_tos->p_stack[parser_state_tos->tos] == elsehead)
{
parser_state_tos->i_l_follow = parser_state_tos->il[parser_state_tos->tos];
}
case dolit:
case forstmt:
case casestmt:
inc_pstack ();
parser_state_tos->p_stack[parser_state_tos->tos] = tk;
parser_state_tos->ind_level = parser_state_tos->i_l_follow;
parser_state_tos->il[parser_state_tos->tos] = parser_state_tos->ind_level;
if (tk != casestmt)
{
parser_state_tos->i_l_follow += settings.ind_size;
}
parser_state_tos->search_brace = settings.btype_2;
break;
case lbrace:
break_comma = 0;
if (parser_state_tos->p_stack[parser_state_tos->tos] == stmt
|| parser_state_tos->p_stack[parser_state_tos->tos] == stmtl)
{
parser_state_tos->i_l_follow += settings.ind_size;
}
else if (parser_state_tos->p_stack[parser_state_tos->tos] == decl)
{
parser_state_tos->i_l_follow += settings.ind_size;
if ( ( (parser_state_tos->last_rw == rw_struct_like) ||
(parser_state_tos->last_rw == rw_enum)) &&
( (parser_state_tos->block_init != 1) ||
(parser_state_tos->block_init_level == 0)) &&
(parser_state_tos->last_token != rparen) &&
(!settings.braces_on_struct_decl_line))
{
parser_state_tos->ind_level += settings.struct_brace_indent;
parser_state_tos->i_l_follow += settings.struct_brace_indent;
}
}
else if (parser_state_tos->p_stack[parser_state_tos->tos] == casestmt)
{
parser_state_tos->ind_level += settings.case_brace_indent - settings.ind_size;
parser_state_tos->i_l_follow += settings.case_brace_indent;
}
else
{
if (s_code == e_code)
{
parser_state_tos->ind_level -= settings.ind_size;
}
if (!settings.btype_2)
{
parser_state_tos->ind_level += settings.brace_indent;
parser_state_tos->i_l_follow += settings.brace_indent;
}
if (parser_state_tos->p_stack[parser_state_tos->tos] == swstmt)
{
parser_state_tos->i_l_follow += settings.case_indent;
}
}
inc_pstack ();
parser_state_tos->p_stack[parser_state_tos->tos] = lbrace;
parser_state_tos->il[parser_state_tos->tos] = parser_state_tos->ind_level;
inc_pstack ();
parser_state_tos->p_stack[parser_state_tos->tos] = stmt;
parser_state_tos->il[parser_state_tos->tos] = parser_state_tos->i_l_follow;
break;
case whilestmt:
if (parser_state_tos->p_stack[parser_state_tos->tos] == dohead)
{
parser_state_tos->i_l_follow = parser_state_tos->il[parser_state_tos->tos];
parser_state_tos->ind_level = parser_state_tos->il[parser_state_tos->tos];
inc_pstack ();
parser_state_tos->p_stack[parser_state_tos->tos] = whilestmt;
parser_state_tos->ind_level = parser_state_tos->i_l_follow;
parser_state_tos->il[parser_state_tos->tos] = parser_state_tos->i_l_follow;
}
else
{
inc_pstack ();
parser_state_tos->p_stack[parser_state_tos->tos] = whilestmt;
parser_state_tos->il[parser_state_tos->tos] = parser_state_tos->i_l_follow;
parser_state_tos->i_l_follow += settings.ind_size;
parser_state_tos->search_brace = settings.btype_2;
}
break;
case elselit:
if (parser_state_tos->p_stack[parser_state_tos->tos] != ifhead)
{
message(gettext("Error"), gettext("Unmatched 'else'"), (char *)(((void *)0)), (char *)(((void *)0)));
}
else
{
parser_state_tos->ind_level = parser_state_tos->il[parser_state_tos->tos];
parser_state_tos->i_l_follow = (parser_state_tos->ind_level + settings.ind_size);
parser_state_tos->p_stack[parser_state_tos->tos] = elsehead;
parser_state_tos->search_brace = 1;
}
break;
case rbrace:
if ((parser_state_tos->tos > 0) && (parser_state_tos->p_stack[parser_state_tos->tos - 1] == lbrace))
{
parser_state_tos->i_l_follow = parser_state_tos->il[--parser_state_tos->tos];
parser_state_tos->ind_level = parser_state_tos->i_l_follow;
parser_state_tos->p_stack[parser_state_tos->tos] = stmt;
}
else
{
message(gettext("Error"), gettext("Stmt nesting error."), (char *)(((void *)0)), (char *)(((void *)0)));
}
break;
case swstmt:
inc_pstack ();
parser_state_tos->p_stack[parser_state_tos->tos] = swstmt;
parser_state_tos->cstk[parser_state_tos->tos] = settings.case_indent + parser_state_tos->i_l_follow;
if (!settings.btype_2)
{
parser_state_tos->cstk[parser_state_tos->tos] += settings.brace_indent;
}
parser_state_tos->il[parser_state_tos->tos] = parser_state_tos->i_l_follow;
parser_state_tos->i_l_follow += settings.ind_size;
parser_state_tos->search_brace = settings.btype_2;
break;
case semicolon:
break_comma = 0;
if (parser_state_tos->p_stack[parser_state_tos->tos] == dostmt)
{
parser_state_tos->p_stack[parser_state_tos->tos] = stmt;
}
else
{
inc_pstack ();
parser_state_tos->p_stack[parser_state_tos->tos] = stmt;
parser_state_tos->il[parser_state_tos->tos] = parser_state_tos->ind_level;
}
break;
default:
fatal (gettext("Unknown code to parser"), 0);
}
reduce ();
return total_success;
}
| {
"array_type": 1,
"break_continue_statement": 8,
"enum_type": 0,
"for_loop": 1,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 17,
"memory_management": 0,
"memory_operation": 0,
"pointer_type": 0,
"return_statement": 1,
"struct_type": 0,
"switch_statement": 1,
"type_casting": 2,
"union_type": 0,
"while_loop": 1
} |
transcoder-set#COUNT_DIGITS_FACTORIAL_SET_2_prep#f_gold.c | transcoder-set | COUNT_DIGITS_FACTORIAL_SET_2.c | f_gold | 6 | long long f_gold ( int n ) {
if ( n < 0 ) return 0;
if ( n <= 1 ) return 1;
double x = ( ( n * log10 ( n / 2.718282 ) + log10 ( 2 * 3.14159265358979323846 * n ) / 2.0 ) );
return floor ( x ) + 1;
}
| {
"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
} |
libxml2#tree_prep#xmlGetCompressMode.c | libxml2 | tree.c | xmlGetCompressMode | 5 | int
xmlGetCompressMode(void)
{
return (xmlCompressMode);
}
| {
"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#ZECKENDORFS_THEOREM_NON_NEIGHBOURING_FIBONACCI_REPRESENTATION_prep#min.c | transcoder-set | ZECKENDORFS_THEOREM_NON_NEIGHBOURING_FIBONACCI_REPRESENTATION.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
} |
less-633#mark_prep#gomark.c | less-633 | mark.c | gomark | 18 | void gomark(LWCHAR c)
{
struct mark *m;
struct scrpos scrpos;
m = getmark(c);
if (m == ((void *)0))
return;
if (m == &marks[(((2*26)+2)-1)] && m->m_scrpos.pos == ((POSITION)(-1)))
cmark(m, curr_ifile, ((POSITION)0), jump_sline);
mark_get_ifile(m);
scrpos = m->m_scrpos;
if (m->m_ifile != curr_ifile)
{
if (edit_ifile(m->m_ifile))
return;
}
jump_loc(scrpos.pos, scrpos.ln);
}
| {
"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": 1,
"return_statement": 2,
"struct_type": 1,
"switch_statement": 0,
"type_casting": 1,
"union_type": 0,
"while_loop": 0
} |
transcoder-set#FIND_MAXIMUM_SUM_POSSIBLE_EQUAL_SUM_THREE_STACKS_prep#f_gold.c | transcoder-set | FIND_MAXIMUM_SUM_POSSIBLE_EQUAL_SUM_THREE_STACKS.c | f_gold | 21 | int f_gold ( int stack1 [ ], int stack2 [ ], int stack3 [ ], int n1, int n2, int n3 ) {
int sum1 = 0, sum2 = 0, sum3 = 0;
for ( int i = 0;
i < n1;
i ++ ) sum1 += stack1 [ i ];
for ( int i = 0;
i < n2;
i ++ ) sum2 += stack2 [ i ];
for ( int i = 0;
i < n3;
i ++ ) sum3 += stack3 [ i ];
int top1 = 0, top2 = 0, top3 = 0;
int ans = 0;
while ( 1 ) {
if ( top1 == n1 || top2 == n2 || top3 == n3 ) return 0;
if ( sum1 == sum2 && sum2 == sum3 ) return sum1;
if ( sum1 >= sum2 && sum1 >= sum3 ) sum1 -= stack1 [ top1 ++ ];
else if ( sum2 >= sum3 && sum2 >= sum3 ) sum2 -= stack2 [ top2 ++ ];
else if ( sum3 >= sum2 && sum3 >= sum1 ) sum3 -= stack3 [ top3 ++ ];
}
}
| {
"array_type": 3,
"break_continue_statement": 0,
"enum_type": 0,
"for_loop": 3,
"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": 0,
"union_type": 0,
"while_loop": 1
} |
transcoder-set#SUM_NODES_K_TH_LEVEL_TREE_REPRESENTED_STRING_prep#max.c | transcoder-set | SUM_NODES_K_TH_LEVEL_TREE_REPRESENTED_STRING.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
} |
cpio-2.14#paxerror_prep#symlink_error.c | cpio-2.14 | paxerror.c | symlink_error | 6 | void
symlink_error (char const *contents, char const *name)
{
int e = (*__errno_location ());
do { if (error_hook) error_hook (); error (0, e, gettext ("%s: Cannot create symlink to %s"), quotearg_colon (name), quote_n (1, contents)); exit_status = 2; } 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
} |
tar-1.34#misc_prep#unquote_string.c | tar-1.34 | misc.c | unquote_string | 86 | int
unquote_string (char *string)
{
int result = 1;
char *source = string;
char *destination = string;
while (*source)
if (*source == '\\')
switch (*++source)
{
case '\\':
*destination++ = '\\';
source++;
break;
case 'a':
*destination++ = '\a';
source++;
break;
case 'b':
*destination++ = '\b';
source++;
break;
case 'f':
*destination++ = '\f';
source++;
break;
case 'n':
*destination++ = '\n';
source++;
break;
case 'r':
*destination++ = '\r';
source++;
break;
case 't':
*destination++ = '\t';
source++;
break;
case 'v':
*destination++ = '\v';
source++;
break;
case '?':
*destination++ = 0177;
source++;
break;
case '0':
case '1':
case '2':
case '3':
case '4':
case '5':
case '6':
case '7':
{
int value = *source++ - '0';
if (*source < '0' || *source > '7')
{
*destination++ = value;
break;
}
value = value * 8 + *source++ - '0';
if (*source < '0' || *source > '7')
{
*destination++ = value;
break;
}
value = value * 8 + *source++ - '0';
*destination++ = value;
break;
}
default:
result = 0;
*destination++ = '\\';
if (*source)
*destination++ = *source++;
break;
}
else if (source != destination)
*destination++ = *source++;
else
source++, destination++;
if (source != destination)
*destination = '\0';
return result;
}
| {
"array_type": 0,
"break_continue_statement": 13,
"enum_type": 0,
"for_loop": 0,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 6,
"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": 1
} |
json.h#allow_json5_prep#json_extract_get_object_size.c | json.h | allow_json5.c | json_extract_get_object_size | 21 | struct json_extract_result_s
json_extract_get_object_size(const struct json_object_s *const object) {
struct json_extract_result_s result;
size_t i;
const struct json_object_element_s *element = object->start;
result.dom_size = sizeof(struct json_object_s) +
(sizeof(struct json_object_element_s) * object->length);
result.data_size = 0;
for (i = 0; i < object->length; i++) {
const struct json_extract_result_s string_result =
json_extract_get_string_size(element->name);
const struct json_extract_result_s value_result =
json_extract_get_value_size(element->value);
result.dom_size += string_result.dom_size;
result.data_size += string_result.data_size;
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
} |
transcoder-set#SEARCHING_ARRAY_ADJACENT_DIFFER_K_prep#cmpfunc.c | transcoder-set | SEARCHING_ARRAY_ADJACENT_DIFFER_K.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
} |
nettle-3.9.1#der-iterator_prep#nettle_asn1_der_iterator_first.c | nettle-3.9.1 | der-iterator.c | nettle_asn1_der_iterator_first | 7 | enum asn1_iterator_result
nettle_asn1_der_iterator_first(struct asn1_der_iterator *i,
size_t length, const uint8_t *input)
{
asn1_der_iterator_init(i, length, input);
return nettle_asn1_der_iterator_next(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
} |
nano-7.2#history_prep#write_list.c | nano-7.2 | history.c | write_list | 12 | _Bool write_list(const linestruct *head, FILE *histfile)
{
const linestruct *item;
for (item = head; item != ((void *)0); item = item->next) {
size_t length = recode_LF_to_NUL(item->data);
if (fwrite(item->data, 1, length, histfile) < length)
return 0;
if (putc('\n', histfile) == (-1))
return 0;
}
return 1;
}
| {
"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": 1,
"return_statement": 3,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 1,
"union_type": 0,
"while_loop": 0
} |
make-4.4.1#rule_prep#create_pattern_rule.c | make-4.4.1 | rule.c | create_pattern_rule | 23 | void
create_pattern_rule (const char **targets, const char **target_percents,
unsigned short n, int terminal, struct dep *deps,
struct commands *commands, int override)
{
unsigned int i;
struct rule *r = xmalloc (sizeof (struct rule));
r->num = n;
r->cmds = commands;
r->deps = deps;
r->targets = targets;
r->suffixes = target_percents;
r->lens = xmalloc (n * sizeof (unsigned int));
r->_defn = ((void *)0);
for (i = 0; i < n; ++i)
{
r->lens[i] = (unsigned int) strlen (targets[i]);
((void) (0));
++r->suffixes[i];
}
if (new_pattern_rule (r, override))
r->terminal = terminal ? 1 : 0;
}
| {
"array_type": 3,
"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": 0,
"struct_type": 3,
"switch_statement": 0,
"type_casting": 3,
"union_type": 0,
"while_loop": 0
} |
nettle-3.9.1#rsa-sha1-sign-tr_prep#nettle_rsa_sha1_sign_digest_tr.c | nettle-3.9.1 | rsa-sha1-sign-tr.c | nettle_rsa_sha1_sign_digest_tr | 17 | int
nettle_rsa_sha1_sign_digest_tr(const struct rsa_public_key *pub,
const struct rsa_private_key *key,
void *random_ctx, nettle_random_func *random,
const uint8_t *digest,
mpz_t s)
{
mpz_t m;
int res;
__gmpz_init (m);
res = (nettle_pkcs1_rsa_sha1_encode_digest(m, key->size, digest)
&& nettle_rsa_compute_root_tr (pub, key,
random_ctx, random,
s, m));
__gmpz_clear (m);
return res;
}
| {
"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
} |
nettle-3.9.1#yarrow_key_event_prep#nettle_yarrow_key_event_estimate.c | nettle-3.9.1 | yarrow_key_event.c | nettle_yarrow_key_event_estimate | 23 | unsigned
nettle_yarrow_key_event_estimate(struct yarrow_key_event_ctx *ctx,
unsigned key, unsigned time)
{
unsigned entropy = 0;
unsigned i;
if (ctx->previous && (time > ctx->previous) )
{
if ( (time - ctx->previous) >= 256)
entropy++;
}
ctx->previous = time;
if (!key)
return entropy;
for (i = 0; i < 16; i++)
if (key == ctx->chars[i])
return entropy;
if (ctx->chars[ctx->index])
entropy++;
ctx->chars[ctx->index] = key;
ctx->index = (ctx->index + 1) % 16;
return entropy;
}
| {
"array_type": 1,
"break_continue_statement": 0,
"enum_type": 0,
"for_loop": 1,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 5,
"memory_management": 0,
"memory_operation": 0,
"pointer_type": 0,
"return_statement": 3,
"struct_type": 1,
"switch_statement": 0,
"type_casting": 0,
"union_type": 0,
"while_loop": 0
} |
nettle-3.9.1#nettle-benchmark_prep#main.c | nettle-3.9.1 | nettle-benchmark.c | main | 120 | int
main(int argc, char **argv)
{
unsigned i;
int c;
const char *alg;
nettle_openssl_init();
const struct nettle_hash *hashes[] =
{
&nettle_md2, &nettle_md4, &nettle_md5,
&nettle_openssl_md5,
&nettle_sha1, &nettle_openssl_sha1,
&nettle_sha224, &nettle_sha256,
&nettle_sha384, &nettle_sha512,
&nettle_sha512_224, &nettle_sha512_256,
&nettle_sha3_224, &nettle_sha3_256,
&nettle_sha3_384, &nettle_sha3_512,
&nettle_ripemd160, &nettle_gosthash94,
&nettle_gosthash94cp, &nettle_streebog256,
&nettle_streebog512, &nettle_sm3,
((void *)0)
};
const struct nettle_cipher *ciphers[] =
{
&nettle_aes128, &nettle_aes192, &nettle_aes256,
&nettle_openssl_aes128,
&nettle_openssl_aes192,
&nettle_openssl_aes256,
&nettle_blowfish128, &nettle_openssl_blowfish128,
&nettle_camellia128, &nettle_camellia192, &nettle_camellia256,
&nettle_cast128, &nettle_openssl_cast128,
&nettle_des, &nettle_openssl_des,
&nettle_des3,
&nettle_serpent256,
&nettle_twofish128, &nettle_twofish192, &nettle_twofish256,
&nettle_sm4,
((void *)0)
};
const struct nettle_aead *aeads[] =
{
&nettle_arcfour128,
&nettle_salsa20, &nettle_salsa20r12, &nettle_chacha,
&nettle_cbc_aes128, &nettle_cbc_aes192, &nettle_cbc_aes256,
&nettle_gcm_aes128,
&nettle_gcm_aes192,
&nettle_gcm_aes256,
&nettle_openssl_gcm_aes128,
&nettle_openssl_gcm_aes192,
&nettle_openssl_gcm_aes256,
&nettle_gcm_camellia128,
&nettle_gcm_camellia256,
&nettle_eax_aes128,
&nettle_chacha_poly1305,
&nettle_ocb_aes128,
((void *)0)
};
enum { OPT_HELP = 300 };
static const struct option options[] =
{
{ "help", 0, ((void *)0), OPT_HELP },
{ "clock-frequency", 1, ((void *)0), 'f' },
{ ((void *)0), 0, ((void *)0), 0 }
};
while ( (c = getopt_long(argc, argv, "f:", options, ((void *)0))) != -1)
switch (c)
{
case 'f':
frequency = atof(optarg);
if (frequency > 0.0)
break;
case OPT_HELP:
printf("Usage: nettle-benchmark [-f clock frequency] [alg...]\n");
return 0;
case '?':
return 1;
default:
abort();
}
time_init();
bench_sha1_compress();
bench_salsa20_core();
bench_sha3_permute();
bench_ghash_update();
printf("\n");
header();
do
{
alg = argv[optind];
if (!alg || strstr ("memxor", alg))
{
time_memxor();
printf("\n");
}
for (i = 0; hashes[i]; i++)
if (!alg || strstr(hashes[i]->name, alg))
time_hash(hashes[i]);
if (!alg || strstr ("umac", alg))
time_umac();
if (!alg || strstr ("cmac", alg))
time_cmac();
if (!alg || strstr ("poly1305-aes", alg))
time_poly1305_aes();
for (i = 0; ciphers[i]; i++)
if (!alg || strstr(ciphers[i]->name, alg))
time_cipher(ciphers[i]);
for (i = 0; aeads[i]; i++)
if (!alg || strstr(aeads[i]->name, alg))
time_aead(aeads[i]);
if (!alg || strstr ("hmac-md5", alg))
time_hmac_md5();
if (!alg || strstr ("hmac-sha1", alg))
time_hmac_sha1();
if (!alg || strstr ("hmac-sha256", alg))
time_hmac_sha256();
if (!alg || strstr ("hmac-sha512", alg))
time_hmac_sha512();
optind++;
} while (alg && argv[optind]);
return 0;
}
| {
"array_type": 4,
"break_continue_statement": 1,
"enum_type": 0,
"for_loop": 3,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 12,
"memory_management": 0,
"memory_operation": 0,
"pointer_type": 4,
"return_statement": 3,
"struct_type": 3,
"switch_statement": 1,
"type_casting": 7,
"union_type": 0,
"while_loop": 2
} |
libxml2#dict_prep#xmlCleanupRandom.c | libxml2 | dict.c | xmlCleanupRandom | 4 | void
xmlCleanupRandom(void) {
xmlCleanupMutex(&xmlRngMutex);
}
| {
"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#osip_uri_prep#osip_uri_init.c | libosip2-5.3.1 | osip_uri.c | osip_uri_init | 14 | int osip_uri_init(osip_uri_t **url) {
*url = (osip_uri_t *) (osip_malloc_func ? osip_malloc_func(sizeof(osip_uri_t)) : malloc(sizeof(osip_uri_t)));
if (*url == ((void *)0))
return -4;
(*url)->scheme = ((void *)0);
(*url)->username = ((void *)0);
(*url)->password = ((void *)0);
(*url)->host = ((void *)0);
(*url)->port = ((void *)0);
osip_list_init(&(*url)->url_params);
osip_list_init(&(*url)->url_headers);
(*url)->string = ((void *)0);
return 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": 1,
"memory_operation": 0,
"pointer_type": 0,
"return_statement": 2,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 7,
"union_type": 0,
"while_loop": 0
} |
heman#vec4_prep#kmVec4Lerp.c | heman | vec4.c | kmVec4Lerp | 7 | kmVec4* kmVec4Lerp(kmVec4* pOut, const kmVec4* pV1, const kmVec4* pV2, float t) {
pOut->x = pV1->x + t * ( pV2->x - pV1->x );
pOut->y = pV1->y + t * ( pV2->y - pV1->y );
pOut->z = pV1->z + t * ( pV2->z - pV1->z );
pOut->w = pV1->w + t * ( pV2->w - pV1->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#NUMBER_DIGITS_PRODUCT_TWO_NUMBERS_1_prep#f_filled.c | transcoder-set | NUMBER_DIGITS_PRODUCT_TWO_NUMBERS_1.c | f_filled | 1 | int f_filled ( 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": 0,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 0,
"union_type": 0,
"while_loop": 0
} |
dap-3.10#dappp_prep#get1c.c | dap-3.10 | dappp.c | get1c | 16 | int get1c(FILE *fp)
{
int c;
c = getc(fp);
if (newline)
{
lineno++;
column = 0;
}
else
column++;
newline = (c == '\n');
if (newline)
pound = 0;
return c;
}
| {
"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": 0,
"union_type": 0,
"while_loop": 0
} |
tulipindicators-0.9.1#tiamalgamation_prep#ti_lag.c | tulipindicators-0.9.1 | tiamalgamation.c | ti_lag | 13 | int ti_lag(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 < 0) return 1;
if (size <= ti_lag_start(options)) return 0;
int i;
for (i = period; i < size; ++i) {
*output++ = input[i-period];
}
((void) sizeof ((output - outputs[0] == size - ti_lag_start(options)) ? 1 : 0), __extension__ ({ if (output - outputs[0] == size - ti_lag_start(options)) ; else __assert_fail ("output - outputs[0] == size - ti_lag_start(options)", "tiamalgamation.c", 2691, __extension__ __PRETTY_FUNCTION__); }));
return 0;
}
| {
"array_type": 3,
"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": 3,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 2,
"union_type": 0,
"while_loop": 0
} |
libosip2-5.3.1#osip_port_prep#osip_strncasecmp.c | libosip2-5.3.1 | osip_port.c | osip_strncasecmp | 3 | int osip_strncasecmp(const char *s1, const char *s2, size_t len) {
return strncasecmp(s1, s2, len);
}
| {
"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
} |
findutils-4.9.0#util_prep#insert_primary_withpred.c | findutils-4.9.0 | util.c | insert_primary_withpred | 14 | struct predicate *
insert_primary_withpred (const struct parser_table *entry,
PRED_FUNC pred_func,
const char *arg)
{
struct predicate *new_pred;
new_pred = get_new_pred_chk_op (entry, arg);
new_pred->pred_func = pred_func;
new_pred->p_name = entry->parser_name;
new_pred->args.str = ((void *)0);
new_pred->p_type = PRIMARY_TYPE;
new_pred->p_prec = NO_PREC;
return new_pred;
}
| {
"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": 2,
"switch_statement": 0,
"type_casting": 1,
"union_type": 0,
"while_loop": 0
} |
libxml2#libxml2-py_prep#libxml_xmlCatalogResolveSystem.c | libxml2 | libxml2-py.c | libxml_xmlCatalogResolveSystem | 11 | PyObject *
libxml_xmlCatalogResolveSystem(PyObject *self __attribute__ ((__unused__)), PyObject *args) {
PyObject *py_retval;
xmlChar * c_retval;
xmlChar * sysID;
if (!_PyArg_ParseTuple_SizeT(args, (char *)"z:xmlCatalogResolveSystem", &sysID))
return(((void *)0));
c_retval = xmlCatalogResolveSystem(sysID);
py_retval = libxml_xmlCharPtrWrap((xmlChar *) 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
} |
nettle-3.9.1#bignum-random_prep#nettle_mpz_random_size.c | nettle-3.9.1 | bignum-random.c | nettle_mpz_random_size | 14 | void
nettle_mpz_random_size(mpz_t x,
void *ctx, nettle_random_func *random,
unsigned bits)
{
unsigned length = (bits + 7) / 8;
uint8_t *data; size_t tmp_data_size;
do { tmp_data_size = (length); (data) = _nettle_gmp_alloc(sizeof (*data) * (length)); } while (0);
random(ctx, length, data);
nettle_mpz_set_str_256_u(x, length, data);
if (bits % 8)
__gmpz_fdiv_r_2exp(x, x, bits);
(_nettle_gmp_free(data, tmp_data_size));
}
| {
"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": 0,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 0,
"union_type": 0,
"while_loop": 1
} |
nano-7.2#nano_prep#disable_kb_interrupt.c | nano-7.2 | nano.c | disable_kb_interrupt | 7 | void disable_kb_interrupt(void)
{
struct termios settings = {0};
tcgetattr(0, &settings);
settings.c_lflag &= ~0000001;
tcsetattr(0, 0, &settings);
}
| {
"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": 1,
"union_type": 0,
"while_loop": 0
} |
screen-4.9.0#viewport_prep#RethinkDisplayViewports.c | screen-4.9.0 | viewport.c | RethinkDisplayViewports | 33 | int RethinkDisplayViewports() {
struct canvas *cv;
struct viewport *vp, *vpn;
for (cv = display->d_cvlist; cv; cv = cv->c_next) {
for (vp = cv->c_vplist; vp; vp = vpn) {
vp->v_canvas = 0;
vpn = vp->v_next;
bzero((char *)vp, sizeof(*vp));
free(vp);
}
cv->c_vplist = 0;
}
display->d_vpxmin = -1;
display->d_vpxmax = -1;
for (cv = display->d_cvlist; cv; cv = cv->c_next) {
if ((vp = (struct viewport *)malloc(sizeof *vp)) == 0)
return -1;
vp->v_canvas = cv;
vp->v_xs = cv->c_xs;
vp->v_ys = cv->c_ys;
vp->v_xe = cv->c_xe;
vp->v_ye = cv->c_ye;
vp->v_xoff = cv->c_xoff;
vp->v_yoff = cv->c_yoff;
vp->v_next = cv->c_vplist;
cv->c_vplist = vp;
if (cv->c_xs < display->d_vpxmin || display->d_vpxmin == -1)
display->d_vpxmin = cv->c_xs;
if (cv->c_xe > display->d_vpxmax || display->d_vpxmax == -1)
display->d_vpxmax = cv->c_xe;
}
return 0;
}
| {
"array_type": 0,
"break_continue_statement": 0,
"enum_type": 0,
"for_loop": 3,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 3,
"memory_management": 2,
"memory_operation": 0,
"pointer_type": 3,
"return_statement": 2,
"struct_type": 2,
"switch_statement": 0,
"type_casting": 2,
"union_type": 0,
"while_loop": 0
} |
json.h#allow_json5_prep#json_write_pretty.c | json.h | allow_json5.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#utils_prep#enter_system_variable.c | enscript-1.6.6 | utils.c | enter_system_variable | 16 | void
enter_system_variable (name, value)
char *name;
char *value;
{
Node *n, *old_val;
n = node_alloc (nSTRING);
n->u.str.len = strlen (value);
n->u.str.data = xstrdup (value);
if (!strhash_put (ns_vars, name, strlen (name), n, (void **) &old_val))
{
fprintf (stderr, gettext ("%s: out of memory\n"), program);
exit (1);
}
node_free (old_val);
}
| {
"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": 0,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 0,
"union_type": 0,
"while_loop": 0
} |
less-633#ttyin_prep#default_wheel_lines.c | less-633 | ttyin.c | default_wheel_lines | 5 | int default_wheel_lines(void)
{
int lines = 1;
return lines;
}
| {
"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#STEINS_ALGORITHM_FOR_FINDING_GCD_1_prep#main.c | transcoder-set | STEINS_ALGORITHM_FOR_FINDING_GCD_1.c | main | 15 | int main(void) {
int n_success = 0;
int param0[] = {52,36,12,69,45,7,45,62,96,89};
int param1[] = {29,94,6,7,11,51,55,86,63,12};
for(int i = 0; i < len(param0); ++i)
{
if(f_filled(param0[i],param1[i]) == f_gold(param0[i],param1[i]))
{
n_success+=1;
}
break;
}
printf("#Results:", " ", n_success, ", ", len(param0));
return 0;
}
| {
"array_type": 2,
"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
} |
wget-1.21.4#utils_prep#file_exists_p.c | wget-1.21.4 | utils.c | file_exists_p | 27 | _Bool
file_exists_p (const char *filename, file_stats_t *fstats)
{
struct stat buf;
if (!filename)
return 0;
(*__errno_location ()) = 0;
if (stat (filename, &buf) == 0 && ((((buf.st_mode)) & 0170000) == (0100000)) &&
(((0400 & buf.st_mode) && (getuid() == buf.st_uid)) ||
(((0400 >> 3) & buf.st_mode) && group_member(buf.st_gid)) ||
(((0400 >> 3) >> 3) & buf.st_mode))) {
if (fstats != ((void *)0))
{
fstats->access_err = 0;
fstats->st_ino = buf.st_ino;
fstats->st_dev = buf.st_dev;
}
return 1;
}
else
{
if (fstats != ((void *)0))
fstats->access_err = ((*__errno_location ()) == 0 ? 13 : (*__errno_location ()));
(*__errno_location ()) = 0;
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": 3,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 2,
"union_type": 0,
"while_loop": 0
} |
libosip2-5.3.1#osip_authentication_info_prep#osip_authentication_info_to_str.c | libosip2-5.3.1 | osip_authentication_info.c | osip_authentication_info_to_str | 114 | int osip_authentication_info_to_str(const osip_authentication_info_t *ainfo, char **dest) {
size_t len;
char *tmp, *start;
*dest = ((void *)0);
if (ainfo == ((void *)0))
return -2;
len = 0;
if (ainfo->auth_type != ((void *)0))
len = len + strlen(ainfo->auth_type) + 1;
if (ainfo->nextnonce != ((void *)0))
len = len + strlen(ainfo->nextnonce) + 12;
if (ainfo->rspauth != ((void *)0))
len = len + strlen(ainfo->rspauth) + 10;
if (ainfo->cnonce != ((void *)0))
len = len + strlen(ainfo->cnonce) + 9;
if (ainfo->nonce_count != ((void *)0))
len = len + strlen(ainfo->nonce_count) + 5;
if (ainfo->qop_options != ((void *)0))
len = len + strlen(ainfo->qop_options) + 6;
if (ainfo->snum != ((void *)0))
len = len + strlen(ainfo->snum) + 7;
if (ainfo->srand != ((void *)0))
len = len + strlen(ainfo->srand) + 8;
if (ainfo->targetname != ((void *)0))
len = len + strlen(ainfo->targetname) + 13;
if (ainfo->realm != ((void *)0))
len = len + strlen(ainfo->realm) + 8;
if (ainfo->opaque != ((void *)0))
len = len + strlen(ainfo->opaque) + 9;
if (len == 0)
return -2;
len++;
tmp = (char *) (osip_malloc_func ? osip_malloc_func(len) : malloc(len));
if (tmp == ((void *)0))
return -4;
*dest = tmp;
start = tmp;
if (ainfo->auth_type != ((void *)0)) {
tmp = osip_str_append(tmp, ainfo->auth_type);
tmp = osip_str_append(tmp, " ");
start = tmp;
}
if (ainfo->qop_options != ((void *)0)) {
if (tmp != start) {
tmp = osip_strn_append(tmp, ", ", 2);
}
tmp = osip_strn_append(tmp, "qop=", 4);
tmp = osip_str_append(tmp, ainfo->qop_options);
}
if (ainfo->nextnonce != ((void *)0)) {
if (tmp != start) {
tmp = osip_strn_append(tmp, ", ", 2);
}
tmp = osip_strn_append(tmp, "nextnonce=", 10);
tmp = osip_str_append(tmp, ainfo->nextnonce);
}
if (ainfo->rspauth != ((void *)0)) {
if (tmp != start) {
tmp = osip_strn_append(tmp, ", ", 2);
}
tmp = osip_strn_append(tmp, "rspauth=", 8);
tmp = osip_str_append(tmp, ainfo->rspauth);
}
if (ainfo->cnonce != ((void *)0)) {
if (tmp != start) {
tmp = osip_strn_append(tmp, ", ", 2);
}
tmp = osip_strn_append(tmp, "cnonce=", 7);
tmp = osip_str_append(tmp, ainfo->cnonce);
}
if (ainfo->nonce_count != ((void *)0)) {
if (tmp != start) {
tmp = osip_strn_append(tmp, ", ", 2);
}
tmp = osip_strn_append(tmp, "nc=", 3);
tmp = osip_str_append(tmp, ainfo->nonce_count);
}
if (ainfo->snum != ((void *)0)) {
if (tmp != start) {
tmp = osip_strn_append(tmp, ", ", 2);
}
tmp = osip_strn_append(tmp, "snum=", 5);
tmp = osip_str_append(tmp, ainfo->snum);
}
if (ainfo->srand != ((void *)0)) {
if (tmp != start) {
tmp = osip_strn_append(tmp, ", ", 2);
}
tmp = osip_strn_append(tmp, "srand=", 6);
tmp = osip_str_append(tmp, ainfo->srand);
}
if (ainfo->targetname != ((void *)0)) {
if (tmp != start) {
tmp = osip_strn_append(tmp, ", ", 2);
}
tmp = osip_strn_append(tmp, "targetname=", 11);
tmp = osip_str_append(tmp, ainfo->targetname);
}
if (ainfo->realm != ((void *)0)) {
if (tmp != start) {
tmp = osip_strn_append(tmp, ", ", 2);
}
tmp = osip_strn_append(tmp, "realm=", 6);
tmp = osip_str_append(tmp, ainfo->realm);
}
if (ainfo->opaque != ((void *)0)) {
if (tmp != start) {
tmp = osip_strn_append(tmp, ", ", 2);
}
tmp = osip_strn_append(tmp, "opaque=", 7);
tmp = osip_str_append(tmp, ainfo->opaque);
}
return 0;
}
| {
"array_type": 0,
"break_continue_statement": 0,
"enum_type": 0,
"for_loop": 0,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 35,
"memory_management": 1,
"memory_operation": 0,
"pointer_type": 2,
"return_statement": 4,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 26,
"union_type": 0,
"while_loop": 0
} |
mcsim-6.2.0#mh_prep#CalculateTotals.c | mcsim-6.2.0 | mh.c | CalculateTotals | 9 | void CalculateTotals (PLEVEL plevel, char **args)
{
PANALYSIS panal = (PANALYSIS)args[0];
double *pdLnPrior = (double*)args[1];
long n;
for (n = 0; n < plevel->nMCVars; n++) {
*pdLnPrior += LnDensity(plevel->rgpMCVars[n], panal);
}
}
| {
"array_type": 2,
"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": 0,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 1,
"union_type": 0,
"while_loop": 0
} |
heman#aabb2_prep#kmAABB2ContainsAABB.c | heman | aabb2.c | kmAABB2ContainsAABB | 18 | unsigned int kmAABB2ContainsAABB(const kmAABB2* container, const kmAABB2* to_check) {
kmVec2 corners[4];
kmVec2Fill(&corners[0], to_check->min.x, to_check->min.y);
kmVec2Fill(&corners[1], to_check->max.x, to_check->min.y);
kmVec2Fill(&corners[2], to_check->max.x, to_check->max.y);
kmVec2Fill(&corners[3], to_check->min.x, to_check->max.y);
int nContains = kmAABB2ContainsPoint( container, &corners[0] ) +
kmAABB2ContainsPoint( container, &corners[1] ) +
kmAABB2ContainsPoint( container, &corners[2] ) +
kmAABB2ContainsPoint( container, &corners[3] );
if( nContains == 0 ){
return (unsigned int)0;
}else if( nContains < 4 ){
return (unsigned int)1;
}else{
return (unsigned int)2;
}
}
| {
"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": 3,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 0,
"union_type": 0,
"while_loop": 0
} |
transcoder-set#HEIGHT_COMPLETE_BINARY_TREE_HEAP_N_NODES_prep#sort.c | transcoder-set | HEIGHT_COMPLETE_BINARY_TREE_HEAP_N_NODES.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
} |
make-4.4.1#hash_prep#hash_free_items.c | make-4.4.1 | hash.c | hash_free_items | 15 | void
hash_free_items (struct hash_table *ht)
{
void **vec = ht->ht_vec;
void **end = &vec[ht->ht_size];
for (; vec < end; vec++)
{
void *item = *vec;
if (!((item) == 0 || (void *) (item) == hash_deleted_item))
free (item);
*vec = 0;
}
ht->ht_fill = 0;
ht->ht_empty_slots = ht->ht_size;
}
| {
"array_type": 0,
"break_continue_statement": 0,
"enum_type": 0,
"for_loop": 1,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 1,
"memory_management": 1,
"memory_operation": 0,
"pointer_type": 3,
"return_statement": 0,
"struct_type": 1,
"switch_statement": 0,
"type_casting": 1,
"union_type": 0,
"while_loop": 0
} |
libxml2#parserInternals_prep#xmlCtxtErrIO.c | libxml2 | parserInternals.c | xmlCtxtErrIO | 32 | void
xmlCtxtErrIO(xmlParserCtxtPtr ctxt, int code, const char *uri)
{
const char *errstr, *msg, *str1, *str2;
xmlErrorLevel level;
if (ctxt == ((void *)0))
return;
if (((code == XML_IO_ENOENT) ||
(code == XML_IO_UNKNOWN))) {
if (ctxt->validate == 0)
level = XML_ERR_WARNING;
else
level = XML_ERR_ERROR;
} else if (code == XML_IO_NETWORK_ATTEMPT) {
level = XML_ERR_ERROR;
} else {
level = XML_ERR_FATAL;
}
errstr = xmlErrString(code);
if (uri == ((void *)0)) {
msg = "%s\n";
str1 = errstr;
str2 = ((void *)0);
} else {
msg = "failed to load \"%s\": %s\n";
str1 = uri;
str2 = errstr;
}
xmlCtxtErr(ctxt, ((void *)0), XML_FROM_IO, code, level,
(const xmlChar *) uri, ((void *)0), ((void *)0), 0,
msg, str1, str2);
}
| {
"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": 4,
"return_statement": 1,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 5,
"union_type": 0,
"while_loop": 0
} |
enscript-1.6.6#lex_prep#yy_scan_bytes.c | enscript-1.6.6 | lex.c | yy_scan_bytes | 19 | YY_BUFFER_STATE yy_scan_bytes (const char * yybytes, int _yybytes_len )
{
YY_BUFFER_STATE b;
char *buf;
yy_size_t n;
int i;
n = _yybytes_len + 2;
buf = (char *) yyalloc(n );
if ( ! buf )
yy_fatal_error( "out of dynamic memory in yy_scan_bytes()" );
for ( i = 0; i < _yybytes_len; ++i )
buf[i] = yybytes[i];
buf[_yybytes_len] = buf[_yybytes_len+1] = 0;
b = yy_scan_buffer(buf,n );
if ( ! b )
yy_fatal_error( "bad buffer in yy_scan_bytes()" );
b->yy_is_our_buffer = 1;
return b;
}
| {
"array_type": 2,
"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": 1,
"return_statement": 1,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 1,
"union_type": 0,
"while_loop": 0
} |
transcoder-set#SMALLEST_POWER_OF_2_GREATER_THAN_OR_EQUAL_TO_N_1_prep#sort.c | transcoder-set | SMALLEST_POWER_OF_2_GREATER_THAN_OR_EQUAL_TO_N_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
} |
libxml2#xmlunicode_prep#xmlUCSIsBoxDrawing.c | libxml2 | xmlunicode.c | xmlUCSIsBoxDrawing | 4 | int
xmlUCSIsBoxDrawing(int code) {
return(((code >= 0x2500) && (code <= 0x257F)));
}
| {
"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#xmlregexp_prep#xmlAutomataNewCountedTrans.c | libxml2 | xmlregexp.c | xmlAutomataNewCountedTrans | 10 | xmlAutomataStatePtr
xmlAutomataNewCountedTrans(xmlAutomataPtr am, xmlAutomataStatePtr from,
xmlAutomataStatePtr to, int counter) {
if ((am == ((void *)0)) || (from == ((void *)0)) || (counter < 0))
return(((void *)0));
xmlFAGenerateCountedEpsilonTransition(am, from, to, counter);
if (to == ((void *)0))
return(am->state);
return(to);
}
| {
"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": 3,
"union_type": 0,
"while_loop": 0
} |
tar-1.34#argp-fmtstream_prep#argp_make_fmtstream.c | tar-1.34 | argp-fmtstream.c | argp_make_fmtstream | 28 | argp_fmtstream_t
argp_make_fmtstream (FILE *stream,
size_t lmargin, size_t rmargin, ssize_t wmargin)
{
argp_fmtstream_t fs;
fs = (struct argp_fmtstream *) malloc (sizeof (struct argp_fmtstream));
if (fs != ((void *)0))
{
fs->stream = stream;
fs->lmargin = lmargin;
fs->rmargin = rmargin;
fs->wmargin = wmargin;
fs->point_col = 0;
fs->point_offs = 0;
fs->buf = (char *) malloc (200);
if (! fs->buf)
{
free (fs);
fs = 0;
}
else
{
fs->p = fs->buf;
fs->end = fs->buf + 200;
}
}
return fs;
}
| {
"array_type": 0,
"break_continue_statement": 0,
"enum_type": 0,
"for_loop": 0,
"function_pointer": 0,
"goto_statement": 0,
"if_statement": 2,
"memory_management": 3,
"memory_operation": 0,
"pointer_type": 0,
"return_statement": 1,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 3,
"union_type": 0,
"while_loop": 0
} |
less-633#decode_prep#add_hometable.c | less-633 | decode.c | add_hometable | 32 | int add_hometable(int (*call_lesskey)(char *, int), char *envname, char *def_filename, int sysvar)
{
char *filename;
int r;
if (envname != ((void *)0) && (filename = lgetenv(envname)) != ((void *)0))
filename = save(filename);
else if (sysvar)
filename = save(def_filename);
else
{
char *xdg = lgetenv("XDG_CONFIG_HOME");
if (!isnullenv(xdg))
filename = dirfile(xdg, &def_filename[1], 1);
if (filename == ((void *)0))
{
char *home = lgetenv("HOME");
if (!isnullenv(home))
{
char *cfg_dir = dirfile(home, ".config", 0);
filename = dirfile(cfg_dir, &def_filename[1], 1);
free(cfg_dir);
}
}
if (filename == ((void *)0))
filename = homefile(def_filename);
}
if (filename == ((void *)0))
return -1;
r = (*call_lesskey)(filename, sysvar);
free(filename);
return (r);
}
| {
"array_type": 1,
"break_continue_statement": 0,
"enum_type": 0,
"for_loop": 0,
"function_pointer": 2,
"goto_statement": 0,
"if_statement": 7,
"memory_management": 2,
"memory_operation": 0,
"pointer_type": 4,
"return_statement": 2,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 4,
"union_type": 0,
"while_loop": 0
} |
brotli-1.0.9#dictionary_prep#BrotliSetDictionaryData.c | brotli-1.0.9 | dictionary.c | BrotliSetDictionaryData | 3 | void BrotliSetDictionaryData(const uint8_t* data) {
(void)(data);
}
| {
"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
} |
units-2.22#parse.tab_prep#unitserror.c | units-2.22 | parse.tab.c | unitserror | 1 | void unitserror(struct commtype *comm, char *s){}
| {
"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
} |
tulipindicators-0.9.1#tiamalgamation_prep#ti_linregintercept_start.c | tulipindicators-0.9.1 | tiamalgamation.c | ti_linregintercept_start | 3 | int ti_linregintercept_start(double const *options) {
return (int)options[0]-1;
}
| {
"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": 1,
"union_type": 0,
"while_loop": 0
} |
tar-1.34#paxnames_prep#removed_prefixes_p.c | tar-1.34 | paxnames.c | removed_prefixes_p | 6 | _Bool
removed_prefixes_p (void)
{
return (prefix_table[0] && hash_get_n_entries (prefix_table[0]) != 0)
|| (prefix_table[1] && hash_get_n_entries (prefix_table[1]) != 0);
}
| {
"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": 1,
"union_type": 0,
"while_loop": 0
} |
transcoder-set#WAYS_REMOVE_ONE_ELEMENT_BINARY_STRING_XOR_BECOMES_ZERO_prep#f_gold.c | transcoder-set | WAYS_REMOVE_ONE_ELEMENT_BINARY_STRING_XOR_BECOMES_ZERO.c | f_gold | 10 | int f_gold ( char str [] ) {
int one_count = 0, zero_count = 0;
int n = strlen(str);
for ( int i = 0;
i < n;
i ++ ) if ( str [ i ] == '1' ) one_count ++;
else zero_count ++;
if ( one_count % 2 == 0 ) return zero_count;
return one_count;
}
| {
"array_type": 1,
"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": 0,
"return_statement": 2,
"struct_type": 0,
"switch_statement": 0,
"type_casting": 0,
"union_type": 0,
"while_loop": 0
} |
libxml2#parserInternals_prep#xmlSwitchToEncoding.c | libxml2 | parserInternals.c | xmlSwitchToEncoding | 13 | int
xmlSwitchToEncoding(xmlParserCtxtPtr ctxt, xmlCharEncodingHandlerPtr handler)
{
int code;
if (ctxt == ((void *)0))
return(-1);
code = xmlInputSetEncodingHandler(ctxt->input, handler);
if (code != XML_ERR_OK) {
xmlCtxtErrIO(ctxt, code, ((void *)0));
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
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.