diff options
-rw-r--r-- | jim-file.c | 14 | ||||
-rw-r--r-- | jim-load.c | 5 | ||||
-rw-r--r-- | jim.c | 5 | ||||
-rw-r--r-- | jimregexp.c | 3 |
4 files changed, 14 insertions, 13 deletions
@@ -430,14 +430,16 @@ static int mkdir_all(char *path) while (ok--) { /* Must have failed the first time, so recursively make the parent and try again */ - char *slash = strrchr(path, '/'); + { + char *slash = strrchr(path, '/'); - if (slash && slash != path) { - *slash = 0; - if (mkdir_all(path) != 0) { - return -1; + if (slash && slash != path) { + *slash = 0; + if (mkdir_all(path) != 0) { + return -1; + } + *slash = '/'; } - *slash = '/'; } first: if (MKDIR_DEFAULT(path) == 0) { @@ -41,7 +41,8 @@ int Jim_LoadLibrary(Jim_Interp *interp, const char *pathName) const char *pkgname; int pkgnamelen; char initsym[40]; - int (*onload) (Jim_Interp *); + typedef int jim_module_init_func_type(Jim_Interp *); + jim_module_init_func_type *onload; pt = strrchr(pathName, '/'); if (pt) { @@ -59,7 +60,7 @@ int Jim_LoadLibrary(Jim_Interp *interp, const char *pathName) } snprintf(initsym, sizeof(initsym), "Jim_%.*sInit", pkgnamelen, pkgname); - if ((onload = dlsym(handle, initsym)) == NULL) { + if ((onload = (jim_module_init_func_type *)dlsym(handle, initsym)) == NULL) { Jim_SetResultFormatted(interp, "No %s symbol found in extension %s", initsym, pathName); } @@ -3822,7 +3822,6 @@ static Jim_Cmd *JimCreateProcedureCmd(Jim_Interp *interp, Jim_Obj *argListObjPtr Jim_Obj *nameObjPtr; Jim_Obj *defaultObjPtr; int len; - int n = 1; /* Examine a parameter */ Jim_ListIndex(interp, argListObjPtr, i, &argPtr, JIM_NONE); @@ -3859,10 +3858,10 @@ err: } else { if (len == 2) { - cmdPtr->u.proc.optArity += n; + cmdPtr->u.proc.optArity++; } else { - cmdPtr->u.proc.reqArity += n; + cmdPtr->u.proc.reqArity++; } } diff --git a/jimregexp.c b/jimregexp.c index 2f57caf..efc56a1 100644 --- a/jimregexp.c +++ b/jimregexp.c @@ -1095,8 +1095,7 @@ int regexec(regex_t *preg, const char *string, size_t nmatch, regmatch_t pmat goto nextline; } while (1) { - int ret = regtry(preg, string); - if (ret) { + if (regtry(preg, string)) { return REG_NOERROR; } if (*string) { |