Skip to content
Snippets Groups Projects
Commit b036dd91 authored by rswindell's avatar rswindell
Browse files

Using parenthesis around pointer macro values.

parent 8e1e5c9c
Branches
Tags
No related merge requests found
......@@ -186,23 +186,23 @@ typedef struct {
#define SAFECOPY(dst,src) sprintf(dst,"%.*s",(int)sizeof(dst)-1,src)
/* Replace every occurance of c1 in str with c2, using p as a temporary char pointer */
#define REPLACE_CHARS(str,c1,c2,p) for(p=(str);*p;p++) if(*p==(c1)) *p=(c2);
#define REPLACE_CHARS(str,c1,c2,p) for((p)=(str);*(p);(p)++) if(*(p)==(c1)) *(p)=(c2);
/* ASCIIZ char* parsing helper macros */
#define SKIP_WHITESPACE(p) while(*p && isspace(*p)) p++;
#define FIND_WHITESPACE(p) while(*p && !isspace(*p)) p++;
#define SKIP_CHAR(p,c) while(*p==c) p++;
#define FIND_CHAR(p,c) while(*p && *p!=c) p++;
#define SKIP_CHARSET(p,s) while(*p && strchr(s,*p)!=NULL) p++;
#define FIND_CHARSET(p,s) while(*p && strchr(s,*p)==NULL) p++;
#define SKIP_ALPHA(p) while(*p && isalpha(*p)) p++;
#define FIND_ALPHA(p) while(*p && !isalpha(*p)) p++;
#define SKIP_ALPHANUMERIC(p) while(*p && isalnum(*p)) p++;
#define FIND_ALPHANUMERIC(p) while(*p && !isalnum(*p)) p++;
#define SKIP_DIGIT(p) while(*p && isdigit(*p)) p++;
#define FIND_DIGIT(p) while(*p && !isdigit(*p)) p++;
#define SKIP_HEXDIGIT(p) while(*p && isxdigit(*p)) p++;
#define FIND_HEXDIGIT(p) while(*p && !isxdigit(*p)) p++;
#define SKIP_WHITESPACE(p) while(*(p) && isspace(*(p))) (p)++;
#define FIND_WHITESPACE(p) while(*(p) && !isspace(*(p))) (p)++;
#define SKIP_CHAR(p,c) while(*(p)==c) (p)++;
#define FIND_CHAR(p,c) while(*(p) && *(p)!=c) (p)++;
#define SKIP_CHARSET(p,s) while(*(p) && strchr(s,*(p))!=NULL) (p)++;
#define FIND_CHARSET(p,s) while(*(p) && strchr(s,*(p))==NULL) (p)++;
#define SKIP_ALPHA(p) while(*(p) && isalpha(*(p))) (p)++;
#define FIND_ALPHA(p) while(*(p) && !isalpha(*(p))) (p)++;
#define SKIP_ALPHANUMERIC(p) while(*(p) && isalnum(*(p))) (p)++;
#define FIND_ALPHANUMERIC(p) while(*(p) && !isalnum(*(p))) (p)++;
#define SKIP_DIGIT(p) while(*(p) && isdigit(*(p))) (p)++;
#define FIND_DIGIT(p) while(*(p) && !isdigit(*(p))) (p)++;
#define SKIP_HEXDIGIT(p) while(*(p) && isxdigit(*(p))) (p)++;
#define FIND_HEXDIGIT(p) while(*(p) && !isxdigit(*(p))) (p)++;
/****************************************************************************/
/* MALLOC/FREE Macros for various compilers and environments */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment