static char *buf = rawbuf;
static int max = 8192;
//static int g_pfd = -1;
-static int subsystem_array[1 << 8];
+static int subsystem_mask = ~0;
static int debug_mask = ~0;
static const char *portal_debug_subsystems[] =
printf("%s output from subsystem \"%s\"\n",
enable ? "Enabling" : "Disabling",
portal_debug_subsystems[i]);
- subsystem_array[i] = enable;
+ if (enable)
+ subsystem_mask |= (1 << i);
+ else
+ subsystem_mask &= ~(1 << i);
found = 1;
}
}
int dbg_initialize(int argc, char **argv)
{
- memset(subsystem_array, 1, sizeof(subsystem_array));
return 0;
}
for (i = 0; portal_debug_masks[i] != NULL; i++)
printf(", %s", portal_debug_masks[i]);
printf("\n");
- }
- else if (strcasecmp(argv[1], "applymasks") == 0) {
- unsigned int subsystem_mask = 0;
- for (i = 0; portal_debug_subsystems[i] != NULL; i++) {
- if (subsystem_array[i]) subsystem_mask |= (1 << i);
- }
+ } else if (strcasecmp(argv[1], "applymasks") == 0) {
applymask_all(subsystem_mask, debug_mask);
}
return 0;
{
char *p, *z;
unsigned long subsystem, debug, dropped = 0, kept = 0;
- int max_sub, max_type, warn = 0;
-
- for (max_sub = 0; portal_debug_subsystems[max_sub] != NULL; max_sub++)
- ;
- for (max_type = 0; portal_debug_masks[max_type] != NULL; max_type++)
- ;
while (size) {
p = memchr(buf, '\n', size);
z++;
/* for some reason %*s isn't working. */
*p = '\0';
- if (subsystem >= max_sub && warn == 0) {
- fprintf(stderr, "warning: unrecognized debug subsystem "
- "%lx; did someone update kp30.h but not "
- "portals/utils/debug.c?\n", subsystem);
- warn = 1;
- }
- if ((subsystem >= max_sub || subsystem_array[subsystem]) &&
+ if ((subsystem_mask & subsystem) &&
(!debug || (debug_mask & debug))) {
if (raw)
fprintf(fd, "%s\n", buf);
static char *buf = rawbuf;
static int max = 8192;
//static int g_pfd = -1;
-static int subsystem_array[1 << 8];
+static int subsystem_mask = ~0;
static int debug_mask = ~0;
static const char *portal_debug_subsystems[] =
printf("%s output from subsystem \"%s\"\n",
enable ? "Enabling" : "Disabling",
portal_debug_subsystems[i]);
- subsystem_array[i] = enable;
+ if (enable)
+ subsystem_mask |= (1 << i);
+ else
+ subsystem_mask &= ~(1 << i);
found = 1;
}
}
int dbg_initialize(int argc, char **argv)
{
- memset(subsystem_array, 1, sizeof(subsystem_array));
return 0;
}
for (i = 0; portal_debug_masks[i] != NULL; i++)
printf(", %s", portal_debug_masks[i]);
printf("\n");
- }
- else if (strcasecmp(argv[1], "applymasks") == 0) {
- unsigned int subsystem_mask = 0;
- for (i = 0; portal_debug_subsystems[i] != NULL; i++) {
- if (subsystem_array[i]) subsystem_mask |= (1 << i);
- }
+ } else if (strcasecmp(argv[1], "applymasks") == 0) {
applymask_all(subsystem_mask, debug_mask);
}
return 0;
{
char *p, *z;
unsigned long subsystem, debug, dropped = 0, kept = 0;
- int max_sub, max_type, warn = 0;
-
- for (max_sub = 0; portal_debug_subsystems[max_sub] != NULL; max_sub++)
- ;
- for (max_type = 0; portal_debug_masks[max_type] != NULL; max_type++)
- ;
while (size) {
p = memchr(buf, '\n', size);
z++;
/* for some reason %*s isn't working. */
*p = '\0';
- if (subsystem >= max_sub && warn == 0) {
- fprintf(stderr, "warning: unrecognized debug subsystem "
- "%lx; did someone update kp30.h but not "
- "portals/utils/debug.c?\n", subsystem);
- warn = 1;
- }
- if ((subsystem >= max_sub || subsystem_array[subsystem]) &&
+ if ((subsystem_mask & subsystem) &&
(!debug || (debug_mask & debug))) {
if (raw)
fprintf(fd, "%s\n", buf);