Skip to contentSkip to conversation

Patch to ignore empty lines in files under /control/

PATCH Christian Laursen 3 participants 4 messages Feb 1, 2007

lore
Share & tools
lore
#0 lore raw

Since empty lines in some of the files in the control dir can result in suprising behaviour I have made a small patch that makes mlmmj ignore those.

As far as I can see empty lines doesn't make any sense in any of the existing tunables, so it should be safe to ignore them.

Unless there are any protests I will probably commit this change sometime tomorrow.

Index: src/ctrlvalues.c
=================================RCS file: /home/mmj/MMJCVS/mlmmj/src/ctrlvalues.c,v retrieving revision 1.2

ctrlvalues.c +2 -0
diff -u -w -r1.2 ctrlvalues.c
@@ -52,6 +52,8 @@
 	ret->strs = NULL;
 	while((value = mygetline(ctrlfd)) != NULL) {
 		chomp(value);
+		if (*value = '\0')
+			continue;
 		ret->count++;
 		ret->strs = (char **) myrealloc(ret->strs, sizeof(char *) *
 					(ret->count + 1));
Signature · 1 line
Christian Laursen
#1 lore raw
Quoted 2 lines · Christian Laursen

Unless there are any protests I will probably commit this change sometime tomorrow.

What about the footer file? ;)

Regards,

#2 lore raw
In reply to Christian Laursen
Quoted 5 lines · Sven 'Darkman' Michels
Quoted 2 lines · Christian Laursen

Unless there are any protests I will probably commit this change sometime tomorrow.

What about the footer file? ;)

As far as I can tell the footer file isn't read by ctrlvalues() so it should remain unaffected.

Signature · 1 line
Christian Laursen
#3 lore raw
In reply to Christian Laursen
Quoted 9 lines · Christian Laursen
Quoted 5 lines · Sven 'Darkman' Michels
Quoted 2 lines · Christian Laursen

Unless there are any protests I will probably commit this change sometime tomorrow.

What about the footer file? ;)

As far as I can tell the footer file isn't read by ctrlvalues() so it should remain unaffected.

True. The footer is added with a call to dumpfd2fd().

I think the patch is fine. You might want to add a comment like /* ignore empty lines */ or something :)

Morten

Signature · 2 lines
Morten K. Poulsen <[email protected]>
http://www.afdelingp.dk/