comparison utils.c @ 18:c08a947d8f30

deal with macro parameters
author David A. Holland
date Mon, 20 Dec 2010 01:51:47 -0500
parents 9dda765ee85c
children 40748b097655
comparison
equal deleted inserted replaced
17:76da41da923f 18:c08a947d8f30
106 strcat(ret, t); 106 strcat(ret, t);
107 strcat(ret, u); 107 strcat(ret, u);
108 return ret; 108 return ret;
109 } 109 }
110 110
111 size_t
112 notrailingws(char *buf, size_t len)
113 {
114 while (len > 0 && strchr(ws, buf[len-1])) {
115 buf[--len] = '\0';
116 }
117 return len;
118 }
119
120 bool
121 is_identifier(const char *str)
122 {
123 size_t len;
124
125 len = strlen(str);
126 if (len != strspn(str, alnum)) {
127 return false;
128 }
129 if (str[0] >= '0' && str[0] <= '9') {
130 return false;
131 }
132 return true;
133 }