switch the "namespace" to "lce"
[libcext.git] / strdup.h
index 34617eaf4dff42ef26341f5293c134b537e8cb5f..3d9f769ac21e1be42f1b80bbe96ffb1e668bde94 100644 (file)
--- a/strdup.h
+++ b/strdup.h
  */
 
 /* https://git.datadissipation.net */
-#ifndef STRDUP_H_
- #define STRDUP_H_      1
+#ifndef LCE_STRDUP_H
+ #define LCE_STRDUP_H      1
 
- #ifdef STRDUP_INCLUDE_LIBC
+ #ifdef LCE_STRDUP_INCLUDE_LIBC
   #include <stdlib.h>
   #include <string.h>
- #endif /* STRDUP_INCLUDE_LIBC */
+ #endif /* LCE_STRDUP_INCLUDE_LIBC */
 
  #ifndef HAVE_STRDUP
   #define HAVE_STRDUP   1
-  #define strdup        i_strdup_
-  #define strndup       i_strndup_
-char *i_strdup_(const char *s);
-char *i_strndup_(const char *s, size_t n);
+  #define strdup        lce_strdup_
+  #define strndup       lce_strndup_
+char *lce_strdup_(const char *s);
+char *lce_strndup_(const char *s, size_t n);
  #endif /* !HAVE_STRDUP */
 
- #ifdef STRDUP_IMPLEMENTATION
+ #ifdef LCE_STRDUP_IMPLEMENTATION
 char *
-i_strdup_(const char *s)
+lce_strdup_(const char *s)
 {
-       char *t = s;
-
        /* avoid calling strlen twice by passing the maximum */
-       return i_strndup_(s, ~(size_t) 0);
+       return lce_strndup_(s, ~(size_t)0);
 }
 
 char *
-i_strndup_(const char *s, size_t n)
+lce_strndup_(const char *s, size_t n)
 {
        char *d;
        size_t t;
@@ -67,5 +65,5 @@ i_strndup_(const char *s, size_t n)
 
        return memcpy(d, s, t - 1);
 }
- #endif /* STRDUP_IMPLEMENTATION */
-#endif /* !STRDUP_H_ */
+ #endif /* LCE_STRDUP_IMPLEMENTATION */
+#endif /* !LCE_STRDUP_H */