Fossil SCM
Always skip adding script commands that have a NULL name or function pointer.
Commit
1b1fd23590ec1e40aa0a6a7a00f3845f0e652d1a
Parent
d6c6a433e712a87…
2 files changed
+4
-2
+2
+4
-2
| --- src/th_lang.c | ||
| +++ src/th_lang.c | ||
| @@ -1054,17 +1054,19 @@ | ||
| 1054 | 1054 | {"return", return_command, 0}, |
| 1055 | 1055 | {"break", simple_command, (void *)TH_BREAK}, |
| 1056 | 1056 | {"continue", simple_command, (void *)TH_CONTINUE}, |
| 1057 | 1057 | {"error", simple_command, (void *)TH_ERROR}, |
| 1058 | 1058 | |
| 1059 | - {0, 0} | |
| 1059 | + {0, 0, 0} | |
| 1060 | 1060 | }; |
| 1061 | 1061 | int i; |
| 1062 | 1062 | |
| 1063 | 1063 | /* Add the language commands. */ |
| 1064 | 1064 | 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; | |
| 1066 | 1068 | Th_CreateCommand(interp, aCommand[i].zName, aCommand[i].xProc, ctx, 0); |
| 1067 | 1069 | } |
| 1068 | 1070 | |
| 1069 | 1071 | return TH_OK; |
| 1070 | 1072 | } |
| 1071 | 1073 |
| --- 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 |
+2
| --- src/th_main.c | ||
| +++ src/th_main.c | ||
| @@ -388,10 +388,11 @@ | ||
| 388 | 388 | {"date", dateCmd, 0}, |
| 389 | 389 | {"html", putsCmd, 0}, |
| 390 | 390 | {"puts", putsCmd, (void*)1}, |
| 391 | 391 | {"wiki", wikiCmd, 0}, |
| 392 | 392 | {"repository", repositoryCmd, 0}, |
| 393 | + {0, 0, 0} | |
| 393 | 394 | }; |
| 394 | 395 | if( g.interp==0 ){ |
| 395 | 396 | int i; |
| 396 | 397 | g.interp = Th_CreateInterp(&vtab); |
| 397 | 398 | th_register_language(g.interp); /* Basic scripting commands. */ |
| @@ -399,10 +400,11 @@ | ||
| 399 | 400 | if( getenv("TH1_ENABLE_TCL")!=0 || db_get_boolean("tcl", 0) ){ |
| 400 | 401 | th_register_tcl(g.interp, &g.tcl); /* Tcl integration commands. */ |
| 401 | 402 | } |
| 402 | 403 | #endif |
| 403 | 404 | for(i=0; i<sizeof(aCommand)/sizeof(aCommand[0]); i++){ |
| 405 | + if ( !aCommand[i].zName || !aCommand[i].xProc ) continue; | |
| 404 | 406 | Th_CreateCommand(g.interp, aCommand[i].zName, aCommand[i].xProc, |
| 405 | 407 | aCommand[i].pContext, 0); |
| 406 | 408 | } |
| 407 | 409 | } |
| 408 | 410 | } |
| 409 | 411 |
| --- 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 |