- Ensure there are CONFIG_ guards in the headers and .c files because
sometime utilities include oslib headers directly and reference oslib
.c files in the Makefile
- Ensure all the oslib/str*.h files have redefinition guards
- Shuffle some #include lines from the .h files to the .c ones
- Ensure the <name>.c files have #include "<name>.h" in them so the
compiler can check the declaration and definition match
Signed-off-by: Sitsofe Wheeler <sitsofe@yahoo.com>
+#ifndef CONFIG_STRCASESTR
+
#include <ctype.h>
#include <stddef.h>
#include <ctype.h>
#include <stddef.h>
-
-#ifndef CONFIG_STRCASESTR
char *strcasestr(const char *s1, const char *s2)
{
char *strcasestr(const char *s1, const char *s2)
{
-#ifdef CONFIG_STRCASESTR
-
-#include <string.h>
-
-#else
+#ifndef CONFIG_STRCASESTR
#ifndef FIO_STRCASESTR_H
#define FIO_STRCASESTR_H
#ifndef FIO_STRCASESTR_H
#define FIO_STRCASESTR_H
char *strcasestr(const char *haystack, const char *needle);
#endif
char *strcasestr(const char *haystack, const char *needle);
#endif
+#ifndef CONFIG_STRLCAT
+
#include <string.h>
#include "strlcat.h"
#include <string.h>
#include "strlcat.h"
return dstlen + srclen;
}
return dstlen + srclen;
}
+#ifndef CONFIG_STRLCAT
+
#ifndef FIO_STRLCAT_H
#define FIO_STRLCAT_H
#ifndef FIO_STRLCAT_H
#define FIO_STRLCAT_H
size_t strlcat(char *dst, const char *src, size_t size);
#endif
size_t strlcat(char *dst, const char *src, size_t size);
#endif
+#ifndef CONFIG_HAVE_STRNDUP
+#include <stdlib.h>
+#include <string.h>
-#ifndef CONFIG_HAVE_STRNDUP
-
char *strndup(const char *s, size_t n)
{
char *str = malloc(n + 1);
char *strndup(const char *s, size_t n)
{
char *str = malloc(n + 1);
#ifndef CONFIG_HAVE_STRNDUP
#ifndef CONFIG_HAVE_STRNDUP
+#ifndef FIO_STRNDUP_LIB_H
+#define FIO_STRNDUP_LIB_H
+
+#include <stddef.h>
+
char *strndup(const char *s, size_t n);
#endif
char *strndup(const char *s, size_t n);
#endif
+#ifndef CONFIG_STRSEP
+
+#include <stddef.h>
+#include "strsep.h"
char *strsep(char **stringp, const char *delim)
{
char *strsep(char **stringp, const char *delim)
{
} while (sc != 0);
} while (1);
}
} while (sc != 0);
} while (1);
}
#ifndef FIO_STRSEP_LIB_H
#define FIO_STRSEP_LIB_H
char *strsep(char **, const char *);
#endif
#ifndef FIO_STRSEP_LIB_H
#define FIO_STRSEP_LIB_H
char *strsep(char **, const char *);
#endif