summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJosé Roberto de Souza <zehortigoza@profusion.mobi>2013-01-03 14:05:56 +0000
committerLucas De Marchi <lucas.demarchi@profusion.mobi>2013-01-03 14:05:56 +0000
commit62676bebb7ebdc3817aa069c7f87daab9aea6b9a (patch)
tree52664a327d25cead5d835a61b5bbaa3a584e1ec2 /src
parent30a6da0e7f788a2cbd014afc7ef91eaeb77c394c (diff)
edbus codegen: Optimizations
Use eina_strbuf_string_steal() instead of strdup() + eina_strbuf_string_get(). Patch by: José Roberto de Souza <zehortigoza@profusion.mobi> SVN revision: 82073
Diffstat (limited to 'src')
-rw-r--r--src/bin/edbus/parser.c2
-rw-r--r--src/bin/edbus/utils.c11
2 files changed, 6 insertions, 7 deletions
diff --git a/src/bin/edbus/parser.c b/src/bin/edbus/parser.c
index 55bbab8409..36b1810d1c 100644
--- a/src/bin/edbus/parser.c
+++ b/src/bin/edbus/parser.c
@@ -201,7 +201,7 @@ open_signal(const char *content, unsigned length, Eina_Bool is_open_empty)
201 eina_strbuf_append_char(buf, toupper(d_signal->name[i])); 201 eina_strbuf_append_char(buf, toupper(d_signal->name[i]));
202 } 202 }
203 eina_strbuf_append(buf, "_EVENT"); 203 eina_strbuf_append(buf, "_EVENT");
204 d_signal->signal_event = strdup(eina_strbuf_string_get(buf)); 204 d_signal->signal_event = eina_strbuf_string_steal(buf);
205 eina_strbuf_free(buf); 205 eina_strbuf_free(buf);
206 206
207 return r; 207 return r;
diff --git a/src/bin/edbus/utils.c b/src/bin/edbus/utils.c
index a7d6273380..02e7fb033b 100644
--- a/src/bin/edbus/utils.c
+++ b/src/bin/edbus/utils.c
@@ -20,7 +20,7 @@ file_read(const char *file_name, char **buffer)
20 eina_strbuf_append_char(buf, data); 20 eina_strbuf_append_char(buf, data);
21 21
22 fclose(xml_handler); 22 fclose(xml_handler);
23 *buffer = strdup(eina_strbuf_string_get(buf)); 23 *buffer = eina_strbuf_string_steal(buf);
24 eina_strbuf_free(buf); 24 eina_strbuf_free(buf);
25 25
26 return EINA_TRUE; 26 return EINA_TRUE;
@@ -62,8 +62,7 @@ dbus_name_to_c(const char *dbus)
62 while ((pch = strtok(NULL, "/."))) 62 while ((pch = strtok(NULL, "/.")))
63 eina_strbuf_append_printf(buffer, "_%s",pch); 63 eina_strbuf_append_printf(buffer, "_%s",pch);
64 64
65 ret = strdup(eina_strbuf_string_get(buffer)); 65 ret = eina_strbuf_string_steal(buffer);
66 eina_strbuf_reset(buffer);
67 for (i = 0; ret[i]; i++) 66 for (i = 0; ret[i]; i++)
68 { 67 {
69 if (i > 0 && ret[i-1] != '_' && ret[i] > '@' && ret[i] < '[')//upper case 68 if (i > 0 && ret[i-1] != '_' && ret[i] > '@' && ret[i] < '[')//upper case
@@ -72,7 +71,7 @@ dbus_name_to_c(const char *dbus)
72 eina_strbuf_append_char(buffer, tolower(ret[i])); 71 eina_strbuf_append_char(buffer, tolower(ret[i]));
73 } 72 }
74 free(ret); 73 free(ret);
75 ret = strdup(eina_strbuf_string_get(buffer)); 74 ret = eina_strbuf_string_steal(buffer);
76end: 75end:
77 free(str_cpy); 76 free(str_cpy);
78 eina_strbuf_free(buffer); 77 eina_strbuf_free(buffer);
@@ -93,7 +92,7 @@ replace_string(const char *string, const char *substr, const char *replacement)
93 while ((pch = strtok(NULL, substr))) 92 while ((pch = strtok(NULL, substr)))
94 eina_strbuf_append_printf(buffer, "%s%s", replacement, pch); 93 eina_strbuf_append_printf(buffer, "%s%s", replacement, pch);
95 94
96 ret = strdup(eina_strbuf_string_get(buffer)); 95 ret = eina_strbuf_string_steal(buffer);
97 free(str_cpy); 96 free(str_cpy);
98 eina_strbuf_free(buffer); 97 eina_strbuf_free(buffer);
99 return ret; 98 return ret;
@@ -126,7 +125,7 @@ string_build(const char *fmt, ...)
126 eina_strbuf_prepend_vprintf(buffer, fmt, ap); 125 eina_strbuf_prepend_vprintf(buffer, fmt, ap);
127 va_end(ap); 126 va_end(ap);
128 127
129 ret = strdup(eina_strbuf_string_get(buffer)); 128 ret = eina_strbuf_string_steal(buffer);
130 eina_strbuf_free(buffer); 129 eina_strbuf_free(buffer);
131 130
132 return ret; 131 return ret;