Send connman mailing list submissions to
[email protected]
To subscribe or unsubscribe via the World Wide Web, visit
https://lists.01.org/mailman/listinfo/connman
or, via email, send a message with subject or body 'help' to
[email protected]
You can reach the person managing the list at
[email protected]
When replying, please edit your Subject line so it is more specific
than "Re: Contents of connman digest..."
Today's Topics:
1. [PATCH] main: Make -d option repeatable (Slava Monich)
----------------------------------------------------------------------
Message: 1
Date: Wed, 17 May 2017 12:50:04 +0300
From: Slava Monich <[email protected]>
To: [email protected]
Subject: [PATCH] main: Make -d option repeatable
Message-ID: <[email protected]>
Concatenating the patterns makes more sense than using the last
supplied value and leaking the previous allocated pattern like this:
==12150== 70 bytes in 2 blocks are definitely lost in loss record 2,908 of 3,330
==12150== at 0x483F3EC: malloc (vg_replace_malloc.c)
==12150== by 0x4CA90DF: g_malloc (gmem.c)
==12150== by 0x4CC0185: g_strdup (gstrfuncs.c)
==12150== by 0x40F85: parse_debug (main.c)
==12150== by 0x4CADFBB: parse_short_option (goption.c)
==12150== by 0x4CAFC3D: g_option_context_parse (goption.c)
==12150== by 0x1FEAB: main (main.c)
---
src/main.c | 15 ++++++++++++---
1 file changed, 12 insertions(+), 3 deletions(-)
diff --git a/src/main.c b/src/main.c
index 3e6449a..b78a046 100644
--- a/src/main.c
+++ b/src/main.c
@@ -517,10 +517,19 @@ static gboolean option_version = FALSE;
static bool 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;
}
--
1.9.1
------------------------------
Subject: Digest Footer
_______________________________________________
connman mailing list
[email protected]
https://lists.01.org/mailman/listinfo/connman
------------------------------
End of connman Digest, Vol 19, Issue 10
***************************************