From owner-p4-projects@FreeBSD.ORG Sat Jan 21 14:27:30 2006 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 23D1416A422; Sat, 21 Jan 2006 14:27:30 +0000 (GMT) X-Original-To: perforce@freebsd.org Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id DADA016A41F for ; Sat, 21 Jan 2006 14:27:29 +0000 (GMT) (envelope-from bb+lists.freebsd.perforce@cyrus.watson.org) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 21E5143D6A for ; Sat, 21 Jan 2006 14:27:28 +0000 (GMT) (envelope-from bb+lists.freebsd.perforce@cyrus.watson.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.1/8.13.1) with ESMTP id k0LERSkt084062 for ; Sat, 21 Jan 2006 14:27:28 GMT (envelope-from bb+lists.freebsd.perforce@cyrus.watson.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.1/8.13.1/Submit) id k0LERSjD084059 for perforce@freebsd.org; Sat, 21 Jan 2006 14:27:28 GMT (envelope-from bb+lists.freebsd.perforce@cyrus.watson.org) Date: Sat, 21 Jan 2006 14:27:28 GMT Message-Id: <200601211427.k0LERSjD084059@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to bb+lists.freebsd.perforce@cyrus.watson.org using -f From: Robert Watson To: Perforce Change Reviews Cc: Subject: PERFORCE change 90087 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 21 Jan 2006 14:27:31 -0000 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); }