src/server/util/object.c

changeset 424
3df9258cd3cc
parent 423
bb7cff720dd0
child 435
713ec3da79ec
equal deleted inserted replaced
423:bb7cff720dd0 424:3df9258cd3cc
110 110
111 111
112 /* ------------------------------ Expression ------------------------------ */ 112 /* ------------------------------ Expression ------------------------------ */
113 113
114 Expression* condition_create(pool_handle_t *pool, CxList *tokens) { 114 Expression* condition_create(pool_handle_t *pool, CxList *tokens) {
115 115 size_t pos = 0;
116 116 NSAPIExpression *expression = expr_parse_logical_expr(pool, tokens, &pos);
117 if(!expression || pos != tokens->size) {
118 return NULL;
119 }
117 120
118 return NULL; 121 return NULL;
119 } 122 }
120 123
121 124
183 } 186 }
184 return NSAPI_EXPRESSION_NOOP; 187 return NSAPI_EXPRESSION_NOOP;
185 } 188 }
186 189
187 static int token_is_int(cxstring token) { 190 static int token_is_int(cxstring token) {
188 for(size_t i=0;i<token.length;i++) { 191 if(token.length == 0) {
192 return 0;
193 }
194
195 size_t start = 0;
196 if(token.ptr[0] == '-' || token.ptr[0] == '+') {
197 if(token.length < 2) {
198 return 0;
199 }
200 start++;
201 }
202
203 for(size_t i=start;i<token.length;i++) {
189 if(!isdigit(token.ptr[i])) { 204 if(!isdigit(token.ptr[i])) {
190 return 0; 205 return 0;
191 } 206 }
192 } 207 }
193 return 1; 208 return 1;

mercurial