PERFORCE change 90084 for review

Robert Watson rwatson at FreeBSD.org
Sat Jan 21 06:16:18 PST 2006


http://perforce.freebsd.org/chv.cgi?CH=90084

Change 90084 by rwatson at rwatson_sesame on 2006/01/21 14:15:54

	Constify delimiter for class file, no need to make it a variable to
	the parsing function.

Affected files ...

.. //depot/projects/trustedbsd/openbsm/libbsm/bsm_class.c#8 edit

Differences ...

==== //depot/projects/trustedbsd/openbsm/libbsm/bsm_class.c#8 (text+ko) ====

@@ -39,9 +39,9 @@
  * Parse the contents of the audit_class file to return struct au_class_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	*classdelim = ":";
 
 static pthread_mutex_t	mutex = PTHREAD_MUTEX_INITIALIZER;
 
@@ -50,15 +50,15 @@
  * au_class_ent elements; store the result in c.
  */
 static struct au_class_ent *
-classfromstr(char *str, char *delim, struct au_class_ent *c)
+classfromstr(char *str, struct au_class_ent *c)
 {
 	char *classname, *classdesc, *classflag;
 	char *last;
 
 	/* Each line contains flag:name:desc. */
-	classflag = strtok_r(str, delim, &last);
-	classname = strtok_r(NULL, delim, &last);
-	classdesc = strtok_r(NULL, delim, &last);
+	classflag = strtok_r(str, classdelim, &last);
+	classname = strtok_r(NULL, classdelim, &last);
+	classdesc = strtok_r(NULL, classdelim, &last);
 
 	if ((classflag == NULL) || (classname == NULL) || (classdesc == NULL))
 		return (NULL);
@@ -113,7 +113,7 @@
 	tokptr = linestr;
 
 	/* Parse tokptr to au_class_ent components. */
-	if (classfromstr(tokptr, delim, c) == NULL)
+	if (classfromstr(tokptr, c) == NULL)
 		return (NULL);
 
 	return (c);


More information about the p4-projects mailing list