From: Denis Kenzior <denkenz@gmail.com>
To: ofono@ofono.org
Subject: Re: [PATCH] main: Make -d option repeatable
Date: Tue, 04 Oct 2016 22:27:12 -0500 [thread overview]
Message-ID: <57F47310.7090707@gmail.com> (raw)
In-Reply-To: <1475574714-3539-1-git-send-email-slava.monich@jolla.com>
[-- Attachment #1: Type: text/plain, Size: 1109 bytes --]
On 10/04/2016 04:51 AM, Slava Monich wrote:
> Concatenating the patterns makes more sense than using the last
> supplied value and leaking the previous allocated patterns.
> ---
> src/main.c | 17 ++++++++++++++---
> 1 file changed, 14 insertions(+), 3 deletions(-)
>
> diff --git a/src/main.c b/src/main.c
> index 46bb90b..b43bb4e 100644
> --- a/src/main.c
> +++ b/src/main.c
> @@ -137,10 +137,19 @@ static gboolean option_version = FALSE;
> static gboolean parse_debug(const char *key, const char *value,
> gpointer user_data, GError **error)
> {
> - if (value)
> - option_debug = g_strdup(value);
> - else
> + if (value) {
> + if (option_debug) {
> + char *prev = option_debug;
> +
> + option_debug = g_strconcat(prev, ",", value, NULL);
> + g_free(prev);
> + } else {
> + option_debug = g_strdup(value);
> + }
> + } else {
> + g_free(option_debug);
> option_debug = g_strdup("*");
> + }
>
> return TRUE;
> }
> @@ -262,5 +271,7 @@ cleanup:
>
> __ofono_log_cleanup();
>
> + g_free(option_debug);
> +
> return 0;
> }
>
prev parent reply other threads:[~2016-10-05 3:27 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-10-04 9:51 [PATCH] main: Make -d option repeatable Slava Monich
2016-10-05 3:27 ` Denis Kenzior [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=57F47310.7090707@gmail.com \
--to=denkenz@gmail.com \
--cc=ofono@ofono.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.