Microsoft already provides a shim that does this [0].
[0]: https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/strdup-wcsdup?view=msvc-160
#include <sparse/colorutil.h>
#include <sparse/color_palette.h>
-#ifdef _WIN32
-#define strdup(x) _strdup(x)
-#endif
enum {POINTS_ALL = 1, POINTS_LABEL, POINTS_RANDOM};
enum {maxlen = 10000000};
enum {MAX_GRPS = 10000};
#include <cgraph/cgraph.h>
#include <cgraph/cghdr.h>
-#ifdef _WIN32
-#define strdup(x) _strdup(x)
-#endif
-
extern void gv_to_gxl(Agraph_t *, FILE *);
#ifdef HAVE_EXPAT
extern Agraph_t *gxl_to_gv(FILE *);
#include <stdio.h>
#include <cgraph/cgraph.h>
-#ifdef _WIN32
-#define strdup(x) _strdup(x)
-#endif
-
typedef struct {
Dtlink_t link;
unsigned short kind;
char* ip;
char* sep = " \t,";
-#ifdef _WIN32
- s = _strdup(s);
-#else
s = strdup(s);
-#endif
for (ip = strtok (s, sep); ip; ip = strtok (NULL, sep)) {
if (streq(ip,"invis")) flags |= INVIS;
else if (streq(ip,"filled")) flags |= FILL;
#include <stdio.h>
#include <GL/gl.h>
#include <GL/glu.h>
-#ifdef _WIN32
-#define strdup _strdup
-#endif
#ifdef __cplusplus
extern "C" {
#include <common/const.h>
#include <cgraph/strcasecmp.h>
-#ifdef _WIN32
-#define strdup(x) _strdup(x)
-#endif
-
/*
* Define an apis array of name strings using an enumerated api_t as index.
* The enumerated type is defined gvplugin.h. The apis array is