| 197 | } |
| 198 | |
| 199 | static int attr_name_valid(const char *name, size_t namelen) |
| 200 | { |
| 201 | /* |
| 202 | * Attribute name cannot begin with '-' and must consist of |
| 203 | * characters from [-A-Za-z0-9_.]. |
| 204 | */ |
| 205 | if (namelen <= 0 || *name == '-') |
| 206 | return 0; |
| 207 | while (namelen--) { |
| 208 | char ch = *name++; |
| 209 | if (! (ch == '-' || ch == '.' || ch == '_' || |
| 210 | ('0' <= ch && ch <= '9') || |
| 211 | ('a' <= ch && ch <= 'z') || |
| 212 | ('A' <= ch && ch <= 'Z')) ) |
| 213 | return 0; |
| 214 | } |
| 215 | return 1; |
| 216 | } |
| 217 | |
| 218 | static void report_invalid_attr(const char *name, size_t len, |
| 219 | const char *src, int lineno) |
no outgoing calls
no test coverage detected