Re: [PATCH 7/8] Use posix_spawn to run external scripts

Pawel Kot <[email protected]> Mon, 3 Dec 2018 18:28:56 +0300
Newsgroups gmane.linux.drivers.gnokii
Message-ID <CAHytCw66Jws0ZtNvc2DQdOvJkbQsaZY54MO1kU+4jOVUy-RKdQ@mail.gmail.com>
Hi,

On Mon, Dec 3, 2018 at 12:54 PM Ladislav Michl <[email protected]> wrote:
>
> posix_spawn specification dates back to last century and its
> implementation is mature enough in all systems we do support.
> Thus use it instead of current fork and exec in hope it will
> save us some resources.

There is more than this in this patch. Would you mind in splitting it into
two or more parts? A large portion of the patch is related to reorganizing
the code. Two examples below.

Cheers,
Paweł

> diff --git a/include/gnokii-internal.h b/include/gnokii-internal.h
> index c4f6d625..9af2d8cc 100644
> --- a/include/gnokii-internal.h
> +++ b/include/gnokii-internal.h
> @@ -20,6 +20,7 @@
>  #ifndef _gnokii_internal_h
>  #define _gnokii_internal_h
>
> +#include "cfgreader.h"

I think I was trying to avoid that for a long time. Not sure now about the
reasoning.

> -typedef void (*cfg_foreach_func)(const char *section, const char *key,
const char *value);
> -void cfg_foreach(const char *section, cfg_foreach_func func);
> +#define cfg_foreach_entry(section, header, entry) \
> +       for (; header != NULL; header = header->next) \
> +               if (strcmp(section, h->section) == 0) \
> +                       for (entry = h->entries; entry != NULL; entry =
entry->next)

Why that?

Cheers
Paweł
--
Pawel Kot

_______________________________________________
gnokii-users mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/gnokii-users