Revision 454e202d trace/simple.c
b/trace/simple.c | ||
---|---|---|
324 | 324 |
bool trace_event_set_state(const char *name, bool state) |
325 | 325 |
{ |
326 | 326 |
unsigned int i; |
327 |
|
|
327 |
unsigned int len; |
|
328 |
bool wildcard = false; |
|
329 |
bool matched = false; |
|
330 |
|
|
331 |
len = strlen(name); |
|
332 |
if (len > 0 && name[len - 1] == '*') { |
|
333 |
wildcard = true; |
|
334 |
len -= 1; |
|
335 |
} |
|
328 | 336 |
for (i = 0; i < NR_TRACE_EVENTS; i++) { |
337 |
if (wildcard) { |
|
338 |
if (!strncmp(trace_list[i].tp_name, name, len)) { |
|
339 |
trace_list[i].state = state; |
|
340 |
matched = true; |
|
341 |
} |
|
342 |
continue; |
|
343 |
} |
|
329 | 344 |
if (!strcmp(trace_list[i].tp_name, name)) { |
330 | 345 |
trace_list[i].state = state; |
331 | 346 |
return true; |
332 | 347 |
} |
333 | 348 |
} |
334 |
return false;
|
|
349 |
return matched;
|
|
335 | 350 |
} |
336 | 351 |
|
337 | 352 |
/* Helper function to create a thread with signals blocked. Use glib's |
Also available in: Unified diff