[BusyBox-cvs] busybox/editors sed.c,1.98,1.99

Glenn McGrath bug1 at busybox.net
Sun Mar 9 10:24:00 UTC 2003


Update of /var/cvs/busybox/editors
In directory winder:/tmp/cvs-serv4978

Modified Files:
	sed.c 
Log Message:
use typedef for struct sed_cmd


Index: sed.c
===================================================================
RCS file: /var/cvs/busybox/editors/sed.c,v
retrieving revision 1.98
retrieving revision 1.99
diff -u -d -r1.98 -r1.99
--- sed.c	9 Mar 2003 08:44:49 -0000	1.98
+++ sed.c	9 Mar 2003 10:23:57 -0000	1.99
@@ -63,7 +63,7 @@
 static int be_quiet = 0;
 
 
-struct sed_cmd {
+typedef struct sed_cmd_s {
 	/* Order by alignment requirements */
 
 	/* address storage */
@@ -101,10 +101,10 @@
 
 	/* inversion flag */
 	int invert;         /* the '!' after the address */ 
-};
+} sed_cmd_t;
 
 /* globals */
-static struct sed_cmd *sed_cmds = NULL; /* growable arrary holding a sequence of sed cmds */
+static sed_cmd_t *sed_cmds = NULL; /* growable arrary holding a sequence of sed cmds */
 static int ncmds = 0; /* number of sed commands */
 
 /*static char *cur_file = NULL;*/ /* file currently being processed XXX: do I need this? */
@@ -208,7 +208,7 @@
 	return idx;
 }
 
-static int parse_subst_cmd(struct sed_cmd * const sed_cmd, const char *substr)
+static int parse_subst_cmd(sed_cmd_t * const sed_cmd, const char *substr)
 {
 	int oldidx, cflags = REG_NEWLINE;
 	char *match;
@@ -292,7 +292,7 @@
 	memmove(str, str + offset, strlen(str + offset) + 1);
 }
 
-static int parse_edit_cmd(struct sed_cmd *sed_cmd, const char *editstr)
+static int parse_edit_cmd(sed_cmd_t *sed_cmd, const char *editstr)
 {
 	int i, j;
 
@@ -343,7 +343,7 @@
 }
 
 
-static int parse_file_cmd(struct sed_cmd *sed_cmd, const char *filecmdstr)
+static int parse_file_cmd(sed_cmd_t *sed_cmd, const char *filecmdstr)
 {
 	int idx = 0;
 	int filenamelen = 0;
@@ -380,7 +380,7 @@
 }
 
 
-static char *parse_cmd_str(struct sed_cmd * const sed_cmd, char *cmdstr)
+static char *parse_cmd_str(sed_cmd_t * const sed_cmd, char *cmdstr)
 {
 	int idx = 0;
 
@@ -483,9 +483,9 @@
 			continue;
 		}
 		/* grow the array */
-		sed_cmds = xrealloc(sed_cmds, sizeof(struct sed_cmd) * (++ncmds));
+		sed_cmds = xrealloc(sed_cmds, sizeof(sed_cmd_t) * (++ncmds));
 		/* zero new element */
-		memset(&sed_cmds[ncmds-1], 0, sizeof(struct sed_cmd));
+		memset(&sed_cmds[ncmds-1], 0, sizeof(sed_cmd_t));
 		/* load command string into new array element, get remainder */
 		mystr = parse_cmd_str(&sed_cmds[ncmds-1], mystr);
 
@@ -592,7 +592,7 @@
 	}
 }
 
-static int do_subst_command(const struct sed_cmd *sed_cmd, char **line)
+static int do_subst_command(const sed_cmd_t *sed_cmd, char **line)
 {
 	char *hackline = *line;
 	struct pipeline thepipe = { NULL, 0 , 0};
@@ -676,7 +676,7 @@
 
 		/* for every line, go through all the commands */
 		for (i = 0; i < ncmds; i++) {
-			struct sed_cmd *sed_cmd = &sed_cmds[i];
+			sed_cmd_t *sed_cmd = &sed_cmds[i];
 			int deleted = 0;
 
 			/*




More information about the busybox-cvs mailing list