瀏覽代碼

Make debug_print_value a macro, add print_value

Lucas Stadler 9 年之前
父節點
當前提交
56ceb734f4
共有 1 個文件被更改,包括 6 次插入2 次删除
  1. 6 2
      c/ton/main.c

+ 6 - 2
c/ton/main.c

@ -25,8 +25,13 @@ JSObjectRef get_function(JSContextRef ctx, char *namespace, char *name);
25 25
26 26
char* get_contents(char *path);
27 27
28
void debug_print_value(char *prefix, JSContextRef ctx, JSValueRef exception) {
29 28
#ifdef DEBUG
29
#define debug_print_value(prefix, ctx, val)	print_value(prefix, ctx, val);
30
#else
31
#define debug_print_value(prefix, ctx, val) ;
32
#endif
33
34
void print_value(char *prefix, JSContextRef ctx, JSValueRef exception) {
30 35
	if (exception != NULL) {
31 36
		JSStringRef ex_str = to_string(ctx, exception);
32 37
		char ex_buf[1000];
@ -35,7 +40,6 @@ void debug_print_value(char *prefix, JSContextRef ctx, JSValueRef exception) {
35 40
		printf("%s: %s\n", prefix, ex_buf);
36 41
		JSStringRelease(ex_str);
37 42
	}
38
#endif
39 43
}
40 44
41 45
JSValueRef function_console_log(JSContextRef ctx, JSObjectRef function, JSObjectRef this_object,