Fossil SCM

Always skip adding script commands that have a NULL name or function pointer.

mistachkin 2011-11-05 03:05 trunk
Commit 1b1fd23590ec1e40aa0a6a7a00f3845f0e652d1a
2 files changed +4 -2 +2
+4 -2
--- src/th_lang.c
+++ src/th_lang.c
@@ -1054,17 +1054,19 @@
10541054
{"return", return_command, 0},
10551055
{"break", simple_command, (void *)TH_BREAK},
10561056
{"continue", simple_command, (void *)TH_CONTINUE},
10571057
{"error", simple_command, (void *)TH_ERROR},
10581058
1059
- {0, 0}
1059
+ {0, 0, 0}
10601060
};
10611061
int i;
10621062
10631063
/* Add the language commands. */
10641064
for(i=0; i<(sizeof(aCommand)/sizeof(aCommand[0])); i++){
1065
- void *ctx = aCommand[i].pContext;
1065
+ void *ctx;
1066
+ if ( !aCommand[i].zName || !aCommand[i].xProc ) continue;
1067
+ ctx = aCommand[i].pContext;
10661068
Th_CreateCommand(interp, aCommand[i].zName, aCommand[i].xProc, ctx, 0);
10671069
}
10681070
10691071
return TH_OK;
10701072
}
10711073
--- src/th_lang.c
+++ src/th_lang.c
@@ -1054,17 +1054,19 @@
1054 {"return", return_command, 0},
1055 {"break", simple_command, (void *)TH_BREAK},
1056 {"continue", simple_command, (void *)TH_CONTINUE},
1057 {"error", simple_command, (void *)TH_ERROR},
1058
1059 {0, 0}
1060 };
1061 int i;
1062
1063 /* Add the language commands. */
1064 for(i=0; i<(sizeof(aCommand)/sizeof(aCommand[0])); i++){
1065 void *ctx = aCommand[i].pContext;
 
 
1066 Th_CreateCommand(interp, aCommand[i].zName, aCommand[i].xProc, ctx, 0);
1067 }
1068
1069 return TH_OK;
1070 }
1071
--- src/th_lang.c
+++ src/th_lang.c
@@ -1054,17 +1054,19 @@
1054 {"return", return_command, 0},
1055 {"break", simple_command, (void *)TH_BREAK},
1056 {"continue", simple_command, (void *)TH_CONTINUE},
1057 {"error", simple_command, (void *)TH_ERROR},
1058
1059 {0, 0, 0}
1060 };
1061 int i;
1062
1063 /* Add the language commands. */
1064 for(i=0; i<(sizeof(aCommand)/sizeof(aCommand[0])); i++){
1065 void *ctx;
1066 if ( !aCommand[i].zName || !aCommand[i].xProc ) continue;
1067 ctx = aCommand[i].pContext;
1068 Th_CreateCommand(interp, aCommand[i].zName, aCommand[i].xProc, ctx, 0);
1069 }
1070
1071 return TH_OK;
1072 }
1073
--- src/th_main.c
+++ src/th_main.c
@@ -388,10 +388,11 @@
388388
{"date", dateCmd, 0},
389389
{"html", putsCmd, 0},
390390
{"puts", putsCmd, (void*)1},
391391
{"wiki", wikiCmd, 0},
392392
{"repository", repositoryCmd, 0},
393
+ {0, 0, 0}
393394
};
394395
if( g.interp==0 ){
395396
int i;
396397
g.interp = Th_CreateInterp(&vtab);
397398
th_register_language(g.interp); /* Basic scripting commands. */
@@ -399,10 +400,11 @@
399400
if( getenv("TH1_ENABLE_TCL")!=0 || db_get_boolean("tcl", 0) ){
400401
th_register_tcl(g.interp, &g.tcl); /* Tcl integration commands. */
401402
}
402403
#endif
403404
for(i=0; i<sizeof(aCommand)/sizeof(aCommand[0]); i++){
405
+ if ( !aCommand[i].zName || !aCommand[i].xProc ) continue;
404406
Th_CreateCommand(g.interp, aCommand[i].zName, aCommand[i].xProc,
405407
aCommand[i].pContext, 0);
406408
}
407409
}
408410
}
409411
--- src/th_main.c
+++ src/th_main.c
@@ -388,10 +388,11 @@
388 {"date", dateCmd, 0},
389 {"html", putsCmd, 0},
390 {"puts", putsCmd, (void*)1},
391 {"wiki", wikiCmd, 0},
392 {"repository", repositoryCmd, 0},
 
393 };
394 if( g.interp==0 ){
395 int i;
396 g.interp = Th_CreateInterp(&vtab);
397 th_register_language(g.interp); /* Basic scripting commands. */
@@ -399,10 +400,11 @@
399 if( getenv("TH1_ENABLE_TCL")!=0 || db_get_boolean("tcl", 0) ){
400 th_register_tcl(g.interp, &g.tcl); /* Tcl integration commands. */
401 }
402 #endif
403 for(i=0; i<sizeof(aCommand)/sizeof(aCommand[0]); i++){
 
404 Th_CreateCommand(g.interp, aCommand[i].zName, aCommand[i].xProc,
405 aCommand[i].pContext, 0);
406 }
407 }
408 }
409
--- src/th_main.c
+++ src/th_main.c
@@ -388,10 +388,11 @@
388 {"date", dateCmd, 0},
389 {"html", putsCmd, 0},
390 {"puts", putsCmd, (void*)1},
391 {"wiki", wikiCmd, 0},
392 {"repository", repositoryCmd, 0},
393 {0, 0, 0}
394 };
395 if( g.interp==0 ){
396 int i;
397 g.interp = Th_CreateInterp(&vtab);
398 th_register_language(g.interp); /* Basic scripting commands. */
@@ -399,10 +400,11 @@
400 if( getenv("TH1_ENABLE_TCL")!=0 || db_get_boolean("tcl", 0) ){
401 th_register_tcl(g.interp, &g.tcl); /* Tcl integration commands. */
402 }
403 #endif
404 for(i=0; i<sizeof(aCommand)/sizeof(aCommand[0]); i++){
405 if ( !aCommand[i].zName || !aCommand[i].xProc ) continue;
406 Th_CreateCommand(g.interp, aCommand[i].zName, aCommand[i].xProc,
407 aCommand[i].pContext, 0);
408 }
409 }
410 }
411

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button