aboutsummaryrefslogtreecommitdiff
path: root/jim-regexp.c
diff options
context:
space:
mode:
authorSteve Bennett <steveb@workware.net.au>2011-05-30 17:41:41 +1000
committerSteve Bennett <steveb@workware.net.au>2011-06-01 09:43:25 +1000
commitca1d944f40971c53a76c5bdf2c45f277acfc2e0e (patch)
treec780e408eb39014fbb8b8d70216993bccea55979 /jim-regexp.c
parent878a8fdb576ab96d6e8c497e4dffedf82a9afbcf (diff)
downloadjimtcl-ca1d944f40971c53a76c5bdf2c45f277acfc2e0e.zip
jimtcl-ca1d944f40971c53a76c5bdf2c45f277acfc2e0e.tar.gz
jimtcl-ca1d944f40971c53a76c5bdf2c45f277acfc2e0e.tar.bz2
Add Jim_String() macro
It is very common to get the string value without the length. Jim_String() is a macro which does that. Signed-off-by: Steve Bennett <steveb@workware.net.au>
Diffstat (limited to 'jim-regexp.c')
-rw-r--r--jim-regexp.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/jim-regexp.c b/jim-regexp.c
index 365785f..702fdfe 100644
--- a/jim-regexp.c
+++ b/jim-regexp.c
@@ -86,7 +86,7 @@ static regex_t *SetRegexpFromAny(Jim_Interp *interp, Jim_Obj *objPtr, unsigned f
}
/* Get the string representation */
- pattern = Jim_GetString(objPtr, NULL);
+ pattern = Jim_String(objPtr);
compre = Jim_Alloc(sizeof(regex_t));
if ((ret = regcomp(compre, pattern, REG_EXTENDED | flags)) != 0) {
@@ -140,7 +140,7 @@ int Jim_RegexpCmd(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
}
for (i = 1; i < argc; i++) {
- const char *opt = Jim_GetString(argv[i], NULL);
+ const char *opt = Jim_String(argv[i]);
if (*opt != '-') {
break;
@@ -192,7 +192,7 @@ int Jim_RegexpCmd(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
return JIM_ERR;
}
- pattern = Jim_GetString(argv[i], NULL);
+ pattern = Jim_String(argv[i]);
source_str = Jim_GetString(argv[i + 1], &source_len);
num_vars = argc - i - 2;
@@ -369,7 +369,7 @@ int Jim_RegsubCmd(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
}
for (i = 1; i < argc; i++) {
- const char *opt = Jim_GetString(argv[i], NULL);
+ const char *opt = Jim_String(argv[i]);
if (*opt != '-') {
break;
@@ -412,7 +412,7 @@ int Jim_RegsubCmd(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
if (!regex) {
return JIM_ERR;
}
- pattern = Jim_GetString(argv[i], NULL);
+ pattern = Jim_String(argv[i]);
source_str = Jim_GetString(argv[i + 1], &source_len);
replace_str = Jim_GetString(argv[i + 2], &replace_len);