summaryrefslogtreecommitdiff
path: root/src/bin
diff options
context:
space:
mode:
authorVincent Torri <vincent.torri@gmail.com>2019-05-03 13:09:07 +0100
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>2019-05-03 13:13:57 +0100
commit7db4714db6ed4e540e1048692f29f3ea1f2b88ed (patch)
tree1b5099c40d8afa89cf6586d200599883535180e6 /src/bin
parent7047a056abb6e44811f12bab37546bdfb1ad98ab (diff)
replace strndup with eina_strndup, remove strndup definition in evil and elm_test_dnd
Test Plan: compilation Reviewers: cedric, zmike, raster Subscribers: #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D8814
Diffstat (limited to 'src/bin')
-rw-r--r--src/bin/eina/eina_btlog/eina_btlog.c6
-rw-r--r--src/bin/elementary/test_dnd.c29
-rw-r--r--src/bin/eolian/docs.c2
3 files changed, 9 insertions, 28 deletions
diff --git a/src/bin/eina/eina_btlog/eina_btlog.c b/src/bin/eina/eina_btlog/eina_btlog.c
index 41464611db..913470a1a8 100644
--- a/src/bin/eina/eina_btlog/eina_btlog.c
+++ b/src/bin/eina/eina_btlog/eina_btlog.c
@@ -194,7 +194,7 @@ _atos(const char *prog, const char *bin_dir, const char *bin_name, unsigned long
194 if ((spaces == func_space_count) && (func_done == EINA_FALSE)) 194 if ((spaces == func_space_count) && (func_done == EINA_FALSE))
195 { 195 {
196 *s = '\0'; 196 *s = '\0';
197 *func_name = strndup(buf, (int)(s - &(buf[0]))); 197 *func_name = eina_strndup(buf, (int)(s - &(buf[0])));
198 func_done = EINA_TRUE; 198 func_done = EINA_TRUE;
199 } 199 }
200 else if (*s == '(') 200 else if (*s == '(')
@@ -208,7 +208,7 @@ _atos(const char *prog, const char *bin_dir, const char *bin_name, unsigned long
208 else if ((*s == ':') && (func_done == EINA_TRUE)) 208 else if ((*s == ':') && (func_done == EINA_TRUE))
209 { 209 {
210 *s = '\0'; 210 *s = '\0';
211 *file_name = strndup(f1, (int)(s - f1)); 211 *file_name = eina_strndup(f1, (int)(s - f1));
212 s++; 212 s++;
213 len = strlen(s); 213 len = strlen(s);
214 s[len - 1] = '\0'; /* Remove the closing parenthesis */ 214 s[len - 1] = '\0'; /* Remove the closing parenthesis */
@@ -266,7 +266,7 @@ bt_input_translate(const char *line, char **comment)
266 (int)(fileend - filestart), filestart, 266 (int)(fileend - filestart), filestart,
267 (int)(addrend - addrstart), addrstart, 267 (int)(addrend - addrstart), addrstart,
268 (int)(baseend - basestart), basestart); 268 (int)(baseend - basestart), basestart);
269 *comment = strndup(line, addrstart - line); 269 *comment = eina_strndup(line, addrstart - line);
270 return local; 270 return local;
271} 271}
272 272
diff --git a/src/bin/elementary/test_dnd.c b/src/bin/elementary/test_dnd.c
index 93bed2a397..be0738e122 100644
--- a/src/bin/elementary/test_dnd.c
+++ b/src/bin/elementary/test_dnd.c
@@ -201,25 +201,6 @@ _grid_item_getcb(Evas_Object *obj, Evas_Coord x, Evas_Coord y, int *xposret, int
201 return item; 201 return item;
202} 202}
203 203
204static inline char *
205_strndup(const char *str, size_t len)
206{
207 const char *p;
208 char *ret;
209 size_t slen;
210
211 for (slen = 0, p = str;
212 (slen < len) && (*p);
213 p++, slen++);
214
215 ret = malloc(slen + 1);
216 if (!ret) return NULL;
217
218 if (slen > 0) memcpy(ret, str, slen);
219 ret[slen] = '\0';
220 return ret;
221}
222
223static void 204static void
224_gl_poscb(void *data EINA_UNUSED, Evas_Object *obj, Elm_Object_Item *it, Evas_Coord x, Evas_Coord y, int xposret, int yposret, Elm_Xdnd_Action action EINA_UNUSED) 205_gl_poscb(void *data EINA_UNUSED, Evas_Object *obj, Elm_Object_Item *it, Evas_Coord x, Evas_Coord y, int xposret, int yposret, Elm_Xdnd_Action action EINA_UNUSED)
225{ 206{
@@ -237,7 +218,7 @@ _gl_dropcb(void *data EINA_UNUSED, Evas_Object *obj, Elm_Object_Item *it, Elm_Se
237 if (ev->len <= 0) 218 if (ev->len <= 0)
238 return EINA_FALSE; 219 return EINA_FALSE;
239 220
240 char *dd = _strndup(ev->data, ev->len); 221 char *dd = eina_strndup(ev->data, ev->len);
241 if (!dd) return EINA_FALSE; 222 if (!dd) return EINA_FALSE;
242 char *p = dd; 223 char *p = dd;
243 224
@@ -292,7 +273,7 @@ _grid_dropcb(void *data EINA_UNUSED, Evas_Object *obj, Elm_Object_Item *it, Elm_
292 if (ev->len <= 0) 273 if (ev->len <= 0)
293 return EINA_FALSE; 274 return EINA_FALSE;
294 275
295 char *dd = _strndup(ev->data, ev->len); 276 char *dd = eina_strndup(ev->data, ev->len);
296 if (!dd) return EINA_FALSE; 277 if (!dd) return EINA_FALSE;
297 char *p = dd; 278 char *p = dd;
298 char *s = _drag_data_extract(&p); 279 char *s = _drag_data_extract(&p);
@@ -1000,7 +981,7 @@ static Eina_Bool _drop_box_button_new_cb(void *data, Evas_Object *obj, Elm_Selec
1000 if (ev->len <= 0) 981 if (ev->len <= 0)
1001 return EINA_FALSE; 982 return EINA_FALSE;
1002 983
1003 char *dd = _strndup(ev->data, ev->len); 984 char *dd = eina_strndup(ev->data, ev->len);
1004 if (!dd) return EINA_FALSE; 985 if (!dd) return EINA_FALSE;
1005 char *p = dd; 986 char *p = dd;
1006 char *s = _drag_data_extract(&p); 987 char *s = _drag_data_extract(&p);
@@ -1034,7 +1015,7 @@ static Eina_Bool _drop_but_icon_change_cb(void *data, Evas_Object *obj, Elm_Sele
1034 if (ev->len <= 0) 1015 if (ev->len <= 0)
1035 return EINA_FALSE; 1016 return EINA_FALSE;
1036 1017
1037 char *dd = _strndup(ev->data, ev->len); 1018 char *dd = eina_strndup(ev->data, ev->len);
1038 if (!dd) return EINA_FALSE; 1019 if (!dd) return EINA_FALSE;
1039 char *p = dd; 1020 char *p = dd;
1040 char *s = _drag_data_extract(&p); 1021 char *s = _drag_data_extract(&p);
@@ -1062,7 +1043,7 @@ static Eina_Bool _drop_bg_change_cb(void *data EINA_UNUSED, Evas_Object *obj, El
1062 if (ev->len <= 0) 1043 if (ev->len <= 0)
1063 return EINA_FALSE; 1044 return EINA_FALSE;
1064 1045
1065 char *dd = _strndup(ev->data, ev->len); 1046 char *dd = eina_strndup(ev->data, ev->len);
1066 if (!dd) return EINA_FALSE; 1047 if (!dd) return EINA_FALSE;
1067 char *p = dd; 1048 char *p = dd;
1068 char *s = _drag_data_extract(&p); 1049 char *s = _drag_data_extract(&p);
diff --git a/src/bin/eolian/docs.c b/src/bin/eolian/docs.c
index 9893005b4d..7120612c9d 100644
--- a/src/bin/eolian/docs.c
+++ b/src/bin/eolian/docs.c
@@ -95,7 +95,7 @@ _generate_ref(const Eolian_State *state, const char *refn, Eina_Strbuf *wbuf)
95 } 95 }
96 if (cl) 96 if (cl)
97 { 97 {
98 char *meth = strndup(mname + 1, sfx - mname - 1); 98 char *meth = eina_strndup(mname + 1, sfx - mname - 1);
99 fn = eolian_class_function_by_name_get(cl, meth, ftype); 99 fn = eolian_class_function_by_name_get(cl, meth, ftype);
100 if (ftype == EOLIAN_UNRESOLVED) 100 if (ftype == EOLIAN_UNRESOLVED)
101 ftype = eolian_function_type_get(fn); 101 ftype = eolian_function_type_get(fn);