mirror of
https://github.com/mdbtools/mdbtools.git
synced 2025-04-05 20:31:00 +08:00
Don't rely on strdup / cygwin fix
This commit is contained in:
parent
f1af742ecf
commit
05092351df
@ -4,7 +4,6 @@
|
||||
#include <time.h>
|
||||
#include <locale.h>
|
||||
#include <inttypes.h>
|
||||
#include <string.h>
|
||||
#include <strings.h>
|
||||
|
||||
// for ntohl
|
||||
@ -96,12 +95,6 @@ typedef struct GOptionContext {
|
||||
#define g_free free
|
||||
#define g_realloc realloc
|
||||
|
||||
#if defined _WIN32
|
||||
#define g_strdup _strdup
|
||||
#else
|
||||
#define g_strdup strdup
|
||||
#endif
|
||||
|
||||
#define G_STR_DELIMITERS "_-|> <."
|
||||
|
||||
#define g_ptr_array_index(array, i) \
|
||||
@ -125,6 +118,7 @@ int g_str_equal(const void *str1, const void *str2);
|
||||
char **g_strsplit(const char *haystack, const char *needle, int something);
|
||||
void g_strfreev(char **dir);
|
||||
char *g_strconcat(const char *first, ...);
|
||||
char *g_strdup(const char *src);
|
||||
char *g_strdup_printf(const char *format, ...);
|
||||
gchar *g_strdelimit(gchar *string, const gchar *delimiters, gchar new_delimiter);
|
||||
|
||||
|
@ -5,6 +5,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <getopt.h>
|
||||
|
||||
/* string functions */
|
||||
@ -101,12 +102,17 @@ int vasprintf(char **ret, const char *format, va_list ap) {
|
||||
}
|
||||
#endif
|
||||
|
||||
char *g_strdup(const char *input) {
|
||||
size_t len = strlen(input);
|
||||
return g_memdup(input, len+1);
|
||||
}
|
||||
|
||||
char *g_strdup_printf(const char *format, ...) {
|
||||
char *ret = NULL;
|
||||
va_list argp;
|
||||
|
||||
va_start(argp, format);
|
||||
#ifdef ___CYGWIN__
|
||||
#ifdef __CYGWIN__
|
||||
size_t len = 0;
|
||||
vasnprintf(&ret, &len, format, argp);
|
||||
#else
|
||||
|
Loading…
Reference in New Issue
Block a user