More compile fixes. sharedbits is starting to get really messy.

This commit is contained in:
Pietro Gagliardi 2019-06-08 18:39:59 -04:00
parent 22cc5ad834
commit 379fc230e5
7 changed files with 35 additions and 14 deletions

View File

@ -5,4 +5,5 @@
#include "../sharedbits/alloc_impl.h"
#include "../sharedbits/array_impl.h"
#include "../sharedbits/strsafe_impl.h"
#include "../sharedbits/strdup_impl.h"
#undef sharedbitsPrefix

View File

@ -198,5 +198,3 @@ void *uiControlImplData(uiControl *c)
}
return c->implData;
}
$$

View File

@ -56,6 +56,7 @@ extern bool uiprivSysCheckThread(void);
#define uiprivArrayFree(arr) uiprivArrayFreeFull(&(arr))
#define uiprivArrayAt(arr, T, n) (((T *) (arr.buf)) + (n))
#include "../sharedbits/strsafe_header.h"
#include "../sharedbits/strdup_header.h"
#undef sharedbitsPrefix
// errors.c

View File

@ -0,0 +1,8 @@
// 8 june 2019
// requires: alloc_header.h
#include "start.h"
extern char *sharedbitsPrefixName(Strdup)(const char *s);
#include "end.h"

17
sharedbits/strdup_impl.h Normal file
View File

@ -0,0 +1,17 @@
// 8 june 2019
// requires alloc_header.h and any of the strsafe_* files
#include "start.h"
char *sharedbitsPrefixName(Strdup)(const char *s)
{
char *t;
size_t n;
n = strlen(s);
t = (char *) sharedbitsPrefixName(Alloc)((n + 1) * sizeof (char), "char[]");
sharedbitsPrefixName(Strncpy)(t, s, n + 1);
return t;
}
#include "end.h"

View File

@ -31,6 +31,12 @@ void testingprivInternalError(const char *fmt, ...)
#undef sharedbitsStatic
#undef sharedbitsPrefix
#define sharedbitsPrefix testingpriv
#define testingprivStrncpy testingprivImplStrncpy
#include "../../sharedbits/strdup_impl.h"
#undef testingprivStrncpy
#undef sharedbitsPrefix
int testingprivVsnprintf(char *s, size_t n, const char *fmt, va_list ap)
{
int ret;
@ -52,17 +58,6 @@ int testingprivSnprintf(char *s, size_t n, const char *fmt, ...)
return ret;
}
char *testingprivStrdup(const char *s)
{
char *t;
size_t n;
n = strlen(s);
t = (char *) testingprivAlloc((n + 1) * sizeof (char), "char[]");
testingprivImplStrncpy(t, s, n + 1);
return t;
}
char *testingprivVsmprintf(const char *fmt, va_list ap)
{
char *s;

View File

@ -19,13 +19,14 @@ sharedbitsPrintfFunc(
#define testingprivArrayFree(arr) testingprivArrayFreeFull(&(arr))
#define testingprivArrayAt(arr, T, n) (((T *) (arr.buf)) + (n))
#include "../../sharedbits/strdup_header.h"
#undef sharedbitsPrefix
extern int testingprivVsnprintf(char *s, size_t n, const char *fmt, va_list ap);
sharedbitsPrintfFunc(
extern int testingprivSnprintf(char *s, size_t n, const char *fmt, ...),
3, 4);
extern char *testingprivStrdup(const char *s);
extern char *testingprivVsmprintf(const char *fmt, va_list ap);
sharedbitsPrintfFunc(
extern char *testingprivSmprintf(const char *fmt, ...),