Generify source code
Previously we would fail in some parts of the code if we did not have a premade configuration, now we use any code that was marked as Linux, BSD and Solaris as our basis in order to support building unknown Unix systems.
This commit is contained in:
@@ -36,15 +36,7 @@
|
||||
#ifndef __DYNARRAY_H_
|
||||
#define __DYNARRAY_H_
|
||||
|
||||
#if !defined(__linux__) && !defined(CSRG_BASED) && !defined(sun)
|
||||
#include <generic.h>
|
||||
#endif
|
||||
#if defined(sun) || defined(__linux__) || defined(CSRG_BASED)
|
||||
#define _DELETE_ARRAY(sz) delete[]
|
||||
#else
|
||||
#define _DELETE_ARRAY(sz) delete[(sz)]
|
||||
#endif
|
||||
|
||||
|
||||
// this is used to create an ARRAY of a TYPE
|
||||
#define declare_array(ARRAY, TYPE, BUMP) \
|
||||
|
||||
@@ -41,14 +41,6 @@ typedef void (*privbuf_func)(void *v);
|
||||
#include <stddef.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#if defined(sun) || defined(__linux__) || defined(CSRG_BASED)
|
||||
// Rejects valid inline declarations, claiming they have both internal and
|
||||
// external linkage.
|
||||
#else
|
||||
inline static void *operator new(size_t size) { return malloc((unsigned)size); }
|
||||
inline static void operator delete(void *p) { if (p) free((char*)p); }
|
||||
#endif
|
||||
|
||||
#include <codelibs/dynarray.h>
|
||||
declare_array(privbuf_charbuf, char, 128)
|
||||
declare_array(privbuf_strvec, char*, 128)
|
||||
|
||||
@@ -66,28 +66,11 @@ extern "C"
|
||||
|
||||
#ifdef __cplusplus
|
||||
char *strtokx(char *&ptr, const char *sep);
|
||||
# if !defined(__linux__) && !defined(sun) && !defined(CSRG_BASED)
|
||||
char **strsep(const char *str, const char *sep,
|
||||
boolean whsp = TRUE, int *num = NULL);
|
||||
const char *strcmbn(const char **vec, const char *sep = " ");
|
||||
# endif
|
||||
|
||||
#else /* __STDC__ */
|
||||
char *strtokx(char **ptr, const char *sep);
|
||||
# if !defined(__linux__) && !defined(sun) && !defined(CSRG_BASED)
|
||||
char **strsep(const char *str, const char *sep,
|
||||
boolean whsp, int *num);
|
||||
#endif
|
||||
const char *strcmbn(const char **vec, const char *sep);
|
||||
|
||||
#endif /* __STDC__ */
|
||||
|
||||
|
||||
#ifdef __OBSOLETE
|
||||
size_t nl_strlen(const char *str); /* __OBSOLETE */
|
||||
int strcharsize(const char *str); /* __OBSOLETE */
|
||||
#endif /* __OBSOLETE */
|
||||
|
||||
#else /* C */
|
||||
|
||||
extern void strfree();
|
||||
@@ -102,12 +85,6 @@ extern unsigned strhashi();
|
||||
|
||||
extern char *strupper(), *strlower();
|
||||
|
||||
|
||||
#ifdef __OBSOLETE
|
||||
extern int strcharsize(); /* __OBSOLETE */
|
||||
extern size_t nl_strlen(); /* __OBSOLETE */
|
||||
#endif /* __OBSOLETE */
|
||||
|
||||
#endif /* C */
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
@@ -145,12 +122,6 @@ inline char *strdup(const char *s)
|
||||
|
||||
/* macros for funcs that work on top of privbuf versions */
|
||||
|
||||
/* for backward compatibility only - __OBSOLETE */
|
||||
#ifdef __OBSOLETE
|
||||
#define strpos strstrx /* __OBSOLETE */
|
||||
#define strrpos strrstrx /* __OBSOLETE */
|
||||
#endif /* __OBSOLETE */
|
||||
|
||||
#endif /* C || __STDC__ */
|
||||
|
||||
#endif /* __STRINGX_H_ */
|
||||
|
||||
Reference in New Issue
Block a user