Browse code

Fix compiler warnings.

Török Edvin authored on 2010/05/14 16:40:04
Showing 2 changed files
... ...
@@ -124,6 +124,7 @@ static void tracehook_ptr(struct cli_bc_ctx *ctx, const void *ptr)
124 124
     fprintf(stderr, "[trace] %p\n", ptr);
125 125
 }
126 126
 
127
+static uint8_t debug_flag = 0;
127 128
 static void print_src(const char *file)
128 129
 {
129 130
   char buf[4096];
... ...
@@ -143,7 +144,7 @@ static void print_src(const char *file)
143 143
       }
144 144
     }
145 145
   } while (!found && (nread == sizeof(buf)));
146
-  if (cli_debug_flag)
146
+  if (debug_flag)
147 147
       printf("[clambc] Source code:");
148 148
   do {
149 149
     for (;i+1<nread;i++) {
... ...
@@ -276,7 +277,7 @@ int main(int argc, char *argv[])
276 276
 
277 277
     if (optget(opts,"debug")->enabled) {
278 278
 	cl_debug();
279
-	cli_debug_flag=1;
279
+	debug_flag=1;
280 280
     }
281 281
     rc = cl_init(CL_INIT_DEFAULT);
282 282
     if (rc != CL_SUCCESS) {
... ...
@@ -316,7 +317,7 @@ int main(int argc, char *argv[])
316 316
 	fprintf(stderr,"bytecode load skipped\n");
317 317
 	exit(0);
318 318
     }
319
-    if (cli_debug_flag)
319
+    if (debug_flag)
320 320
 	printf("[clambc] Bytecode loaded\n");
321 321
     if (optget(opts, "info")->enabled) {
322 322
 	cli_bytecode_describe(bc);
... ...
@@ -334,7 +335,7 @@ int main(int argc, char *argv[])
334 334
 	    optfree(opts);
335 335
 	    exit(4);
336 336
 	}
337
-	if (cli_debug_flag)
337
+	if (debug_flag)
338 338
 	    printf("[clambc] Bytecode prepared\n");
339 339
 
340 340
 	ctx = cli_bytecode_context_alloc();
... ...
@@ -360,7 +361,7 @@ int main(int argc, char *argv[])
360 360
 	    funcid = atoi(opts->filename[1]);
361 361
 	}
362 362
 	cli_bytecode_context_setfuncid(ctx, bc, funcid);
363
-	if (cli_debug_flag)
363
+	if (debug_flag)
364 364
 	    printf("[clambc] Running bytecode function :%u\n", funcid);
365 365
 
366 366
 	if (opts->filename[1]) {
... ...
@@ -401,10 +402,10 @@ int main(int argc, char *argv[])
401 401
 	    fprintf(stderr,"Unable to run bytecode: %s\n", cl_strerror(rc));
402 402
 	} else {
403 403
 	    uint64_t v;
404
-	    if (cli_debug_flag)
404
+	    if (debug_flag)
405 405
 		printf("[clambc] Bytecode run finished\n");
406 406
 	    v = cli_bytecode_context_getresult_int(ctx);
407
-	    if (cli_debug_flag)
407
+	    if (debug_flag)
408 408
 		printf("[clambc] Bytecode returned: 0x%llx\n", (long long)v);
409 409
 	}
410 410
 	cli_bytecode_context_destroy(ctx);
... ...
@@ -417,7 +418,7 @@ int main(int argc, char *argv[])
417 417
     optfree(opts);
418 418
     if (fd != -1)
419 419
 	close(fd);
420
-    if (cli_debug_flag)
420
+    if (debug_flag)
421 421
 	printf("[clambc] Exiting\n");
422 422
     return 0;
423 423
 }
... ...
@@ -353,7 +353,7 @@ void cli_hashtab_delete(struct cli_hashtable *s,const char* key,const size_t len
353 353
     struct cli_element *el = cli_hashtab_find(s, key, len);
354 354
     if (!el || el->key == DELETED_KEY)
355 355
 	return;
356
-    free(el->key);
356
+    free((void*)el->key);
357 357
     el->key = DELETED_KEY;
358 358
 }
359 359