/* match token */
found = 0;
- for (i = 0; i < 32; i++) {
- debugstr = bit2str(i);
- if (debugstr != NULL &&
- strlen(debugstr) == len &&
+ for (i = 0; i < 32; i++) {
+ debugstr = bit2str(i);
+ if (debugstr != NULL &&
+ strlen(debugstr) == len &&
strncasecmp(str, debugstr, len) == 0) {
- if (op == '-')
- newmask &= ~(1 << i);
- else
- newmask |= (1 << i);
- found = 1;
- break;
- }
- }
+ if (op == '-')
+ newmask &= ~BIT(i);
+ else
+ newmask |= BIT(i);
+ found = 1;
+ break;
+ }
+ }
if (!found && len == 3 &&
- (strncasecmp(str, "ALL", len) == 0)) {
+ (strncasecmp(str, "ALL", len) == 0)) {
if (op == '-')
newmask = minmask;
else
}
EXPORT_SYMBOL(cfs_firststr);
-char *
-cfs_trimwhite(char *str)
-{
- char *end;
-
- while (isspace(*str))
- str++;
-
- end = str + strlen(str);
- while (end > str) {
- if (!isspace(end[-1]))
- break;
- end--;
- }
-
- *end = 0;
- return str;
-}
-EXPORT_SYMBOL(cfs_trimwhite);
-
/**
* Extracts tokens from strings.
*
return -EINVAL;
}
- LIBCFS_ALLOC(val, sizeof(val[0]) * count);
+ CFS_ALLOC_PTR_ARRAY(val, count);
if (val == NULL)
return -ENOMEM;
/* This array is allocated by LIBCFS_ALLOC(), so it shouldn't be freed
* by OBD_FREE() if it's called by module other than libcfs & LNet,
* otherwise we will see fake memory leak */
- LIBCFS_FREE(values, num * sizeof(values[0]));
+ CFS_FREE_PTR_ARRAY(values, num);
}
EXPORT_SYMBOL(cfs_expr_list_values_free);