All of lore.kernel.org
 help / color / mirror / Atom feed
* Patch to ignore empty lines in files under /control/
@ 2007-02-01 14:57 Christian Laursen
  2007-02-01 15:00 ` Sven 'Darkman' Michels
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Christian Laursen @ 2007-02-01 14:57 UTC (permalink / raw)
  To: mlmmj

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
diff -u -w -r1.2 ctrlvalues.c
--- src/ctrlvalues.c	19 Jun 2004 03:44:47 -0000	1.2
+++ src/ctrlvalues.c	1 Feb 2007 10:52:35 -0000
@@ -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));



-- 
Christian Laursen

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Patch to ignore empty lines in files under /control/
  2007-02-01 14:57 Patch to ignore empty lines in files under /control/ Christian Laursen
@ 2007-02-01 15:00 ` Sven 'Darkman' Michels
  2007-02-01 15:08 ` Christian Laursen
  2007-02-01 22:18 ` Morten K. Poulsen
  2 siblings, 0 replies; 4+ messages in thread
From: Sven 'Darkman' Michels @ 2007-02-01 15:00 UTC (permalink / raw)
  To: mlmmj

Christian Laursen wrote:
> Unless there are any protests I will probably commit this change
> sometime tomorrow.

What about the footer file? ;)

Regards,

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Patch to ignore empty lines in files under /control/
  2007-02-01 14:57 Patch to ignore empty lines in files under /control/ Christian Laursen
  2007-02-01 15:00 ` Sven 'Darkman' Michels
@ 2007-02-01 15:08 ` Christian Laursen
  2007-02-01 22:18 ` Morten K. Poulsen
  2 siblings, 0 replies; 4+ messages in thread
From: Christian Laursen @ 2007-02-01 15:08 UTC (permalink / raw)
  To: mlmmj

Sven 'Darkman' Michels <sven@darkman.de> writes:

> Christian Laursen wrote:
>> 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.

-- 
Christian Laursen

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Patch to ignore empty lines in files under /control/
  2007-02-01 14:57 Patch to ignore empty lines in files under /control/ Christian Laursen
  2007-02-01 15:00 ` Sven 'Darkman' Michels
  2007-02-01 15:08 ` Christian Laursen
@ 2007-02-01 22:18 ` Morten K. Poulsen
  2 siblings, 0 replies; 4+ messages in thread
From: Morten K. Poulsen @ 2007-02-01 22:18 UTC (permalink / raw)
  To: mlmmj


Christian Laursen <xi@borderworlds.dk> wrote:
> Sven 'Darkman' Michels <sven@darkman.de> writes:
>> Christian Laursen wrote:
>>> 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

-- 
Morten K. Poulsen <morten@afdelingp.dk>
http://www.afdelingp.dk/


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2007-02-01 22:18 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-02-01 14:57 Patch to ignore empty lines in files under /control/ Christian Laursen
2007-02-01 15:00 ` Sven 'Darkman' Michels
2007-02-01 15:08 ` Christian Laursen
2007-02-01 22:18 ` Morten K. Poulsen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.