2019-08-25 06:46:40 +02:00
|
|
|
#ifndef _OS_LIBC_H_
|
2019-11-03 20:36:27 +01:00
|
|
|
#define _OS_LIBC_H_
|
2019-08-25 06:46:40 +02:00
|
|
|
|
2019-11-03 20:36:27 +01:00
|
|
|
#include "ultratypes.h"
|
2019-08-25 06:46:40 +02:00
|
|
|
|
2020-05-17 00:18:50 +02:00
|
|
|
// old bstring functions that aren't present on some platforms
|
|
|
|
|
|
|
|
#if defined(__APPLE__)
|
|
|
|
|
|
|
|
// macOS libc has them
|
|
|
|
#include <strings.h>
|
|
|
|
|
|
|
|
#elif defined(_POSIX_C_SOURCE) && (_POSIX_C_SOURCE >= 200809L)
|
|
|
|
|
|
|
|
// there's no way that shit's defined, use memcpy/memset
|
2020-05-16 22:14:10 +02:00
|
|
|
#include <string.h>
|
2020-05-17 00:18:50 +02:00
|
|
|
#undef bzero
|
|
|
|
#undef bcopy
|
|
|
|
#define bzero(buf, len) memset((buf), 0, (len))
|
|
|
|
#define bcopy(src, dst, len) memcpy((dst), (src), (len))
|
|
|
|
|
2020-05-16 22:14:10 +02:00
|
|
|
#else
|
2020-05-17 00:18:50 +02:00
|
|
|
|
|
|
|
// hope for the best
|
2019-11-03 20:36:27 +01:00
|
|
|
extern void bcopy(const void *, void *, size_t);
|
|
|
|
extern void bzero(void *, size_t);
|
2020-05-17 00:18:50 +02:00
|
|
|
|
2020-05-16 22:14:10 +02:00
|
|
|
#endif
|
2019-08-25 06:46:40 +02:00
|
|
|
|
|
|
|
#endif /* !_OS_LIBC_H_ */
|