• R/O
  • SSH
  • HTTPS

yash: Commit


Commit MetaInfo

Revision3912 (tree)
Time2018-11-24 14:13:09
Authormagicant

Log Message

Remove xstrndup

Actually xstrndup is not used at all.

Change Summary

Incremental Difference

--- yash/trunk/util.c (revision 3911)
+++ yash/trunk/util.c (revision 3912)
@@ -61,13 +61,10 @@
6161 #endif
6262
6363 /* Returns a newly malloced copy of the specified string.
64- * The copy is at most `len' bytes long.
65- * Returns an exact copy if (strlen(s) <= len).
6664 * Aborts the program on malloc failure. */
67-char *xstrndup(const char *s, size_t len)
65+char *xstrdup(const char *s)
6866 {
69- len = xstrnlen(s, len);
70-
67+ size_t len = strlen(s);
7168 // char *result = xmalloce(len, 1, sizeof (char));
7269 char *result = xmalloc(add(len, 1));
7370 result[len] = '\0';
--- yash/trunk/util.h (revision 3911)
+++ yash/trunk/util.h (revision 3912)
@@ -167,10 +167,8 @@
167167
168168 extern size_t xstrnlen(const char *s, size_t maxlen)
169169 __attribute__((pure,nonnull));
170-extern char *xstrndup(const char *s, size_t maxlen)
170+extern char *xstrdup(const char *s)
171171 __attribute__((malloc,warn_unused_result,nonnull));
172-static inline char *xstrdup(const char *s)
173- __attribute__((malloc,warn_unused_result,nonnull));
174172 extern size_t xwcsnlen(const wchar_t *s, size_t maxlen)
175173 __attribute__((pure,nonnull));
176174 extern wchar_t *xwcsndup(const wchar_t *s, size_t maxlen)
@@ -207,13 +205,6 @@
207205
208206 /* Returns a newly malloced copy of the specified string.
209207 * Aborts the program if failed to allocate memory. */
210-char *xstrdup(const char *s)
211-{
212- return xstrndup(s, Size_max);
213-}
214-
215-/* Returns a newly malloced copy of the specified string.
216- * Aborts the program if failed to allocate memory. */
217208 wchar_t *xwcsdup(const wchar_t *s)
218209 {
219210 return xwcsndup(s, Size_max);
Show on old repository browser