Date: Sat, 21 Jan 2006 14:27:28 GMT From: Robert Watson <rwatson@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 90087 for review Message-ID: <200601211427.k0LERSjD084059@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=90087 Change 90087 by rwatson@rwatson_sesame on 2006/01/21 14:26:49 Constify eventdelim and don't make it per-call. Affected files ... .. //depot/projects/trustedbsd/openbsm/libbsm/bsm_event.c#7 edit Differences ... ==== //depot/projects/trustedbsd/openbsm/libbsm/bsm_event.c#7 (text+ko) ==== @@ -39,9 +39,9 @@ * Parse the contents of the audit_event file to return * au_event_ent entries */ -static FILE *fp = NULL; -static char linestr[AU_LINE_MAX]; -static char *delim = ":"; +static FILE *fp = NULL; +static char linestr[AU_LINE_MAX]; +static const char *eventdelim = ":"; static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER; @@ -49,16 +49,16 @@ * Parse one line from the audit_event file into the au_event_ent structure. */ static struct au_event_ent * -eventfromstr(char *str, char *delim, struct au_event_ent *e) +eventfromstr(char *str, struct au_event_ent *e) { char *evno, *evname, *evdesc, *evclass; struct au_mask evmask; char *last; - evno = strtok_r(str, delim, &last); - evname = strtok_r(NULL, delim, &last); - evdesc = strtok_r(NULL, delim, &last); - evclass = strtok_r(NULL, delim, &last); + evno = strtok_r(str, eventdelim, &last); + evname = strtok_r(NULL, eventdelim, &last); + evdesc = strtok_r(NULL, eventdelim, &last); + evclass = strtok_r(NULL, eventdelim, &last); if ((evno == NULL) || (evname == NULL) || (evdesc == NULL) || (evclass == NULL)) @@ -144,7 +144,7 @@ * XXXRW: Perhaps we should keep reading lines until we find a valid * one, rather than stopping when we hit an invalid one? */ - if (eventfromstr(linestr, delim, e) == NULL) + if (eventfromstr(linestr, e) == NULL) return (NULL); return (e); @@ -200,7 +200,7 @@ if ((nl = strrchr(linestr, '\n')) != NULL) *nl = '\0'; - if (eventfromstr(linestr, delim, e) != NULL) { + if (eventfromstr(linestr, e) != NULL) { if (strcmp(name, e->ae_name) == 0) return (e); } @@ -254,7 +254,7 @@ if ((nl = strrchr(linestr, '\n')) != NULL) *nl = '\0'; - if (eventfromstr(linestr, delim, e) != NULL) { + if (eventfromstr(linestr, e) != NULL) { if (event_number == e->ae_number) return (e); }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200601211427.k0LERSjD084059>