summaryrefslogtreecommitdiff
path: root/src/string
diff options
context:
space:
mode:
authorJakob Kaivo <jkk@ung.org>2020-08-12 11:02:56 -0400
committerJakob Kaivo <jkk@ung.org>2020-08-12 11:02:56 -0400
commitecd4d00f1bdf184163cc44ed8261d9f11ca9aae0 (patch)
tree7148339b74cfd5f453be629843e4647b8ed3e7a2 /src/string
parentc37709cb45a4dac2c9c8ffb0fdae2361e2ead7de (diff)
remove all generated nonstd/ headers
Diffstat (limited to 'src/string')
-rw-r--r--src/string/memchr.c2
-rw-r--r--src/string/memcmp.c2
-rw-r--r--src/string/memcpy.c2
-rw-r--r--src/string/memmove.c2
-rw-r--r--src/string/memset.c2
-rw-r--r--src/string/strcat.c9
-rw-r--r--src/string/strchr.c2
-rw-r--r--src/string/strcmp.c2
-rw-r--r--src/string/strcoll.c2
-rw-r--r--src/string/strcpy.c2
-rw-r--r--src/string/strcspn.c2
-rw-r--r--src/string/strlen.c2
-rw-r--r--src/string/strncat.c2
-rw-r--r--src/string/strncmp.c2
-rw-r--r--src/string/strncpy.c2
-rw-r--r--src/string/strpbrk.c2
-rw-r--r--src/string/strrchr.c2
-rw-r--r--src/string/strspn.c2
-rw-r--r--src/string/strstr.c2
-rw-r--r--src/string/strtok.c2
-rw-r--r--src/string/strxfrm.c2
21 files changed, 27 insertions, 22 deletions
diff --git a/src/string/memchr.c b/src/string/memchr.c
index 97f6b257..9b795e9b 100644
--- a/src/string/memchr.c
+++ b/src/string/memchr.c
@@ -1,5 +1,5 @@
#include <string.h>
-#include "nonstd/assert.h"
+#include "../_assert.h"
/** search memory **/
void * memchr(const void *s, int c, size_t n)
diff --git a/src/string/memcmp.c b/src/string/memcmp.c
index 64dcb464..f0c1e2da 100644
--- a/src/string/memcmp.c
+++ b/src/string/memcmp.c
@@ -1,5 +1,5 @@
#include <string.h>
-#include "nonstd/assert.h"
+#include "../_assert.h"
/** compare memory regions **/
int memcmp(const void *s1, const void *s2, size_t n)
diff --git a/src/string/memcpy.c b/src/string/memcpy.c
index f53fe5d8..43ac292e 100644
--- a/src/string/memcpy.c
+++ b/src/string/memcpy.c
@@ -1,5 +1,5 @@
#include <string.h>
-#include "nonstd/assert.h"
+#include "../_assert.h"
/** copy memory **/
void * memcpy(void * restrict s1, const void * restrict s2, size_t n)
diff --git a/src/string/memmove.c b/src/string/memmove.c
index 33000e0e..ec8e785d 100644
--- a/src/string/memmove.c
+++ b/src/string/memmove.c
@@ -1,5 +1,5 @@
#include <string.h>
-#include "nonstd/assert.h"
+#include "../_assert.h"
/** move memory **/
void * memmove(void *s1, const void *s2, size_t n)
diff --git a/src/string/memset.c b/src/string/memset.c
index 1f3d14ff..2fdb8551 100644
--- a/src/string/memset.c
+++ b/src/string/memset.c
@@ -1,5 +1,5 @@
#include <string.h>
-#include "nonstd/assert.h"
+#include "../_assert.h"
/** fill memory **/
void * memset(void *s, int c, size_t n)
diff --git a/src/string/strcat.c b/src/string/strcat.c
index 9526cd59..75364ad3 100644
--- a/src/string/strcat.c
+++ b/src/string/strcat.c
@@ -1,9 +1,10 @@
#include <string.h>
-#include "nonstd/assert.h"
+#include "../_assert.h"
/** concatenate strings **/
char * strcat(char * restrict s1, const char * restrict s2)
{
+ size_t i = 0;
ASSERT_NONNULL(s1);
ASSERT_NONNULL(s2);
ASSERT_NOOVERLAP(s1, s2, strlen(s1) + strlen(s2));
@@ -11,7 +12,11 @@ char * strcat(char * restrict s1, const char * restrict s2)
/*
RETURN_ALWAYS(ARGUMENT(s1));
*/
- return strncat(s1, s2, strlen(s2));
+ while (s1[i] != '\0') {
+ i++;
+ }
+
+ return strcpy(s1 + i, s2);
}
/***
diff --git a/src/string/strchr.c b/src/string/strchr.c
index 874db9be..2ee80c9b 100644
--- a/src/string/strchr.c
+++ b/src/string/strchr.c
@@ -1,5 +1,5 @@
#include <string.h>
-#include "nonstd/assert.h"
+#include "../_assert.h"
/** string search **/
char * strchr(const char *s, int c)
diff --git a/src/string/strcmp.c b/src/string/strcmp.c
index ed089c77..fdceeb67 100644
--- a/src/string/strcmp.c
+++ b/src/string/strcmp.c
@@ -1,5 +1,5 @@
#include <string.h>
-#include "nonstd/assert.h"
+#include "../_assert.h"
/** compare strings **/
int strcmp(const char *s1, const char *s2)
diff --git a/src/string/strcoll.c b/src/string/strcoll.c
index 8707ba73..afdf868e 100644
--- a/src/string/strcoll.c
+++ b/src/string/strcoll.c
@@ -1,6 +1,6 @@
#include <string.h>
#include "stdlib.h"
-#include "nonstd/assert.h"
+#include "../_assert.h"
/** collate strings **/
int strcoll(const char *s1, const char *s2)
diff --git a/src/string/strcpy.c b/src/string/strcpy.c
index cf4eeb21..915701d9 100644
--- a/src/string/strcpy.c
+++ b/src/string/strcpy.c
@@ -1,5 +1,5 @@
#include <string.h>
-#include "nonstd/assert.h"
+#include "../_assert.h"
/** copy string **/
char * strcpy(char * restrict s1, const char * restrict s2)
diff --git a/src/string/strcspn.c b/src/string/strcspn.c
index 4bbdee2e..5ae42e04 100644
--- a/src/string/strcspn.c
+++ b/src/string/strcspn.c
@@ -1,5 +1,5 @@
#include <string.h>
-#include "nonstd/assert.h"
+#include "../_assert.h"
/** count non-matching characters **/
size_t strcspn(const char *s1, const char *s2)
diff --git a/src/string/strlen.c b/src/string/strlen.c
index 89ccbfcc..3405b252 100644
--- a/src/string/strlen.c
+++ b/src/string/strlen.c
@@ -1,5 +1,5 @@
#include <string.h>
-#include "nonstd/assert.h"
+#include "../_assert.h"
/** find string length **/
size_t strlen(const char *s)
diff --git a/src/string/strncat.c b/src/string/strncat.c
index 34800069..17ed6b40 100644
--- a/src/string/strncat.c
+++ b/src/string/strncat.c
@@ -1,5 +1,5 @@
#include <string.h>
-#include "nonstd/assert.h"
+#include "../_assert.h"
/** concatenate bounded string **/
char * strncat(char * restrict s1, const char * restrict s2, size_t n)
diff --git a/src/string/strncmp.c b/src/string/strncmp.c
index 23c8104e..f5647d33 100644
--- a/src/string/strncmp.c
+++ b/src/string/strncmp.c
@@ -1,5 +1,5 @@
#include <string.h>
-#include "nonstd/assert.h"
+#include "../_assert.h"
/** compare bound strings **/
int strncmp(const char *s1, const char *s2, size_t n)
diff --git a/src/string/strncpy.c b/src/string/strncpy.c
index ee632d69..290d36c3 100644
--- a/src/string/strncpy.c
+++ b/src/string/strncpy.c
@@ -1,5 +1,5 @@
#include <string.h>
-#include "nonstd/assert.h"
+#include "../_assert.h"
/** copy bounded string **/
char * strncpy(char * restrict s1, const char * restrict s2, size_t n)
diff --git a/src/string/strpbrk.c b/src/string/strpbrk.c
index 0b88b999..e5dfc52d 100644
--- a/src/string/strpbrk.c
+++ b/src/string/strpbrk.c
@@ -1,5 +1,5 @@
#include <string.h>
-#include "nonstd/assert.h"
+#include "../_assert.h"
/** count matching characters **/
char * strpbrk(const char *s1, const char *s2)
diff --git a/src/string/strrchr.c b/src/string/strrchr.c
index 0427aa66..fe40c5db 100644
--- a/src/string/strrchr.c
+++ b/src/string/strrchr.c
@@ -1,5 +1,5 @@
#include <string.h>
-#include "nonstd/assert.h"
+#include "../_assert.h"
/** search string from end **/
char * strrchr(const char *s, int c)
diff --git a/src/string/strspn.c b/src/string/strspn.c
index e67461a5..677d43c2 100644
--- a/src/string/strspn.c
+++ b/src/string/strspn.c
@@ -1,5 +1,5 @@
#include <string.h>
-#include "nonstd/assert.h"
+#include "../_assert.h"
/** count matching characters **/
size_t strspn(const char *s1, const char *s2)
diff --git a/src/string/strstr.c b/src/string/strstr.c
index 898db1be..7aaad5ad 100644
--- a/src/string/strstr.c
+++ b/src/string/strstr.c
@@ -1,5 +1,5 @@
#include <string.h>
-#include "nonstd/assert.h"
+#include "../_assert.h"
/** search for substring **/
char * strstr(const char *s1, const char *s2)
diff --git a/src/string/strtok.c b/src/string/strtok.c
index ed44e9f2..b4d77305 100644
--- a/src/string/strtok.c
+++ b/src/string/strtok.c
@@ -1,5 +1,5 @@
#include <string.h>
-#include "nonstd/assert.h"
+#include "../_assert.h"
/** split string into tokens **/
char * strtok(char * restrict s1, const char * restrict s2)
diff --git a/src/string/strxfrm.c b/src/string/strxfrm.c
index b6ec62b6..4c640a26 100644
--- a/src/string/strxfrm.c
+++ b/src/string/strxfrm.c
@@ -1,5 +1,5 @@
#include <string.h>
-#include "nonstd/assert.h"
+#include "../_assert.h"
/** transform string **/
size_t strxfrm(char * restrict s1, const char * restrict s2, size_t n)