Add platform-specific fixes file

Create a new file, platform.h, for platform-specific hacks

for MSVC, this includes defining strncasecmp to _stricmp and
strdup to _strdup, among other things like defining missing
stat macros

Change some things not supported in MSVC, like _Static_assert,
to their counterparts (in this case, static_assert)

Replace usage of VLAs with malloc and free

Update getopt_long and use the getopt implementation from musl
on Windows.

Use comments to show which functions from platform.h are being used
This commit is contained in:
James Larrowe
2020-07-21 14:24:22 -04:00
parent 0793e9effe
commit e51701acaa
11 changed files with 167 additions and 39 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright © 2005-2019 Rich Felker, et al.
* Copyright © 2005-2020 Rich Felker, et al.
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
@@ -23,8 +23,8 @@
/* This implementation was taken from musl and modified for RGBDS */
#ifndef _GETOPT_H
#define _GETOPT_H
#ifndef RGBDS_EXTERN_GETOPT_H
#define RGBDS_EXTERN_GETOPT_H
extern char *optarg;
extern int optind, opterr, optopt, optreset;