summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/compile.c7
-rw-r--r--lib/execute.c20
-rw-r--r--lib/priv.h2
-rw-r--r--lib/rlib.c5
4 files changed, 15 insertions, 19 deletions
diff --git a/lib/compile.c b/lib/compile.c
index b0cd818..651bd70 100644
--- a/lib/compile.c
+++ b/lib/compile.c
@@ -406,7 +406,7 @@ static void pushValues(compilecontext* ctx, bool forward, ...)
size_t cur = 0;
va_start(ap, forward);
- while(len = va_arg(ap, size_t))
+ while((len = va_arg(ap, size_t)))
{
if(cur + len > VAL_BUF)
{
@@ -623,9 +623,8 @@ bool isEscaped(const char* str, const char* posi)
char* splitTagMatch(r_script* script, char* regexp)
{
char* second = regexp;
- while(second = strchr(second, kTagDelim))
+ while((second = strchr(second, kTagDelim)))
{
- uint escs = 0;
if(!isEscaped(regexp, second))
{
second[0] = '\0';
@@ -939,7 +938,7 @@ int compileStatement(r_script* script, compilecontext* ctx)
compileSpace(ctx);
/* Check for a delimiter */
- if(delim = strchr(kValidDelim, *(ctx->in)))
+ if((delim = strchr(kValidDelim, *(ctx->in))))
{
ctx->in++;
end = ctx->in;
diff --git a/lib/execute.c b/lib/execute.c
index 0662849..5e67b5b 100644
--- a/lib/execute.c
+++ b/lib/execute.c
@@ -236,7 +236,7 @@ void* dataGetValue(data* dat, void* key)
struct dat* d;
ASSERT_PTR(dat);
- if(d = _dataFind(dat, key))
+ if((d = _dataFind(dat, key)))
return d->value;
return NULL;
@@ -252,7 +252,7 @@ bool dataSetValue(data* dat, void* key, void* value)
if(!_dataAllocate(dat))
return false;
- if(d = _dataFind(dat, key))
+ if((d = _dataFind(dat, key)))
{
d->value = value;
}
@@ -374,7 +374,7 @@ struct vari* _variablesFind(variables* vars, const char* name)
}
/* If not found then look up in the Environment */
- if(val = getenv(name))
+ if((val = getenv(name)))
return _variablesNew(vars, name, val, strlen(val));
return NULL;
@@ -442,7 +442,7 @@ bool variablesClear(variables* vars, const char* name)
{
struct vari* v;
ASSERT_PTR(vars);
- if(v = _variablesFind(vars, name))
+ if((v = _variablesFind(vars, name)))
starclr(v->value);
return true;
@@ -485,7 +485,7 @@ static char* _escapeString(const char* string)
while((pos += strcspn(string + pos, kSpecialChars)) < len)
cnt++, pos++;
- if(buff = (char*)malloc(sizeof(char) * (len + cnt + 1)))
+ if((buff = (char*)malloc(sizeof(char) * (len + cnt + 1))))
{
pos = 0;
strcpy(buff, string);
@@ -502,7 +502,6 @@ static char* _escapeString(const char* string)
int variablesSubstitute(variables* vars, r_stream* stream, r_script* script,
char** pstr, bool mode)
{
- size_t len = strlen(*pstr);
char* next = *pstr;
struct internal_state* state = stream->state;
@@ -584,7 +583,7 @@ int variablesSubstitute(variables* vars, r_stream* stream, r_script* script,
next[len] = 0;
/* Do we have this variable? */
- if(v = _variablesFind(vars, next + 1))
+ if((v = _variablesFind(vars, next + 1)))
value = v->value;
else
value = "\0\0";
@@ -638,7 +637,7 @@ int variablesSubstitute(variables* vars, r_stream* stream, r_script* script,
next = strrep(next, 0, starnext(value) ? "|" : "");
}
- while(value = starnext(value));
+ while((value = starnext(value)));
/* Add closing parentheses if needed */
next = strrep(next, 0, multi ? ")" : "");
@@ -683,7 +682,7 @@ bool variablesHasVars(const char* string)
{
const char* cur = string;
- if(cur = strchr(cur, '%'))
+ if((cur = strchr(cur, '%')))
{
if(!isEscaped(string, cur))
return true;
@@ -1109,7 +1108,6 @@ int vmExecute(r_stream* stream, r_script* script)
/* These are the registers passed to PCRE */
int pcreregs[MAX_REGS * 3];
- int num_regs = 0;
/* And over here we have the stack */
uint* vmStack = NULL;
@@ -1268,7 +1266,7 @@ int vmExecute(r_stream* stream, r_script* script)
* - We use the op header pointer as key to the pcre struct
* - And the pcre struct pointer as the key to the pcre_extra struct
*/
- if(re = (pcre*)dataGetValue(&(state->working), header))
+ if((re = (pcre*)dataGetValue(&(state->working), header)))
{
/* This prevents the freeing of stuff below */
cache = true;
diff --git a/lib/priv.h b/lib/priv.h
index d671fd7..ada6845 100644
--- a/lib/priv.h
+++ b/lib/priv.h
@@ -96,7 +96,7 @@ bool vmInit(r_stream* stream);
void vmClean(r_stream* stream);
void vmFree(r_stream* stream);
-static const char* kValidIdentifier = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_";
+#define kValidIdentifier "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_"
#define USE_STACK_VARS
diff --git a/lib/rlib.c b/lib/rlib.c
index 5b308d3..7396160 100644
--- a/lib/rlib.c
+++ b/lib/rlib.c
@@ -37,7 +37,6 @@
int rlibInit(r_stream* stream, long options)
{
- byte* op = NULL;
int i, j;
struct internal_state* state;
@@ -282,7 +281,7 @@ void rlibFree(r_stream* stream, r_script* script)
if(stream)
{
- if(state = stream->state)
+ if((state = stream->state))
{
/* Let execution free it's stuff */
vmFree(stream);
@@ -456,7 +455,7 @@ int repInit(r_context* ctx)
}
#ifdef _DEBUG
-static void* memstr(void* mem, size_t sz, const char* str)
+void* memstr(void* mem, size_t sz, const char* str)
{
size_t len = strlen(str);
const char* t;