summaryrefslogtreecommitdiff
path: root/src/lib/evil
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/lib/evil
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/lib/evil')
-rw-r--r--src/lib/evil/evil_string.c16
-rw-r--r--src/lib/evil/evil_string.h20
2 files changed, 2 insertions, 34 deletions
diff --git a/src/lib/evil/evil_string.c b/src/lib/evil/evil_string.c
index 08ab2d7..3620ce5 100644
--- a/src/lib/evil/evil_string.c
+++ b/src/lib/evil/evil_string.c
@@ -11,24 +11,10 @@
11 11
12 12
13/* 13/*
14 * bit related functions 14 * string related functions
15 * 15 *
16 */ 16 */
17 17
18char *
19strndup(const char *str, size_t n)
20{
21 size_t slen = strnlen(str, n);
22 char *ret;
23
24 ret = malloc (slen + 1);
25 if (!ret) return NULL;
26
27 if (slen > 0) memcpy(ret, str, slen);
28 ret[slen] = '\0';
29 return ret;
30}
31
32char *strcasestr(const char *haystack, const char *needle) 18char *strcasestr(const char *haystack, const char *needle)
33{ 19{
34 size_t length_needle; 20 size_t length_needle;
diff --git a/src/lib/evil/evil_string.h b/src/lib/evil/evil_string.h
index 6dbdb34..872834f 100644
--- a/src/lib/evil/evil_string.h
+++ b/src/lib/evil/evil_string.h
@@ -15,27 +15,9 @@
15 15
16 16
17/* 17/*
18 * bit related functions 18 * string related functions
19 * 19 *
20 */ 20 */
21/**
22 * @brief Duplicate a string
23 *
24 * @param str String to be duplicated
25 * @param n size of new duplicated string
26 * @return The strndup() function returns a pointer to the duplicated string, or NULL if insufficient memory was available.
27 *
28 * This function returns a pointer to a new string which is a duplicate of the string str,
29 * but only copies at most n bytes. If str is longer than n, only n bytes are copied,
30 * and a terminating null byte ('\0') is added.
31 *
32 * Conformity: BSD
33 *
34 * Supported OS: Windows XP.
35 *
36 * @since 1.13
37 */
38EAPI char *strndup(const char *str, size_t n);
39 21
40/** 22/**
41 * @brief Locate a substring into a string, ignoring case. 23 * @brief Locate a substring into a string, ignoring case.