]> git.ipfire.org Git - thirdparty/FORT-validator.git/commitdiff
Remove some of the asn1c and uthash glue code
authorAlberto Leiva Popper <ydahhrk@gmail.com>
Wed, 27 Sep 2023 20:50:26 +0000 (14:50 -0600)
committerAlberto Leiva Popper <ydahhrk@gmail.com>
Wed, 27 Sep 2023 21:12:33 +0000 (15:12 -0600)
The asn1c stuff was autogenerated, and the uthash stuff was copy-pasted
from its source project.

None of it serves any purpose. I'm not allergic to the possibility of
supporting these other environments, but this is not the time for it.
Also, it probably doesn't work anyway, since it has never been tested
in the context of Fort.

This doesn't delete all the glue code; only the necessary parts needed
for the upcoming commit.

src/asn1/asn1c/GeneralizedTime.c
src/asn1/asn1c/UTCTime.c
src/asn1/asn1c/asn_system.h
src/data_structure/uthash.h

index 11515c5c2e1beb3575d4edc70f5346556dd32d72..a7fedc39bccc810972d377ad7116f5bfd8d863df 100644 (file)
 #include "asn1/asn1c/asn_internal.h"
 #include "asn1/asn1c/GeneralizedTime.h"
 
-#ifdef __CYGWIN__
-#include "/usr/include/time.h"
-#else
 #include <time.h>
-#endif /* __CYGWIN__ */
-
 #include <stdio.h>
 #include <errno.h>
 
-#if    defined(_WIN32)
-#pragma message( "PLEASE STOP AND READ!")
-#pragma message( "  localtime_r is implemented via localtime(), which may be not thread-safe.")
-#pragma message( "  gmtime_r is implemented via gmtime(), which may be not thread-safe.")
-#pragma message( "  ")
-#pragma message( "  You must fix the code by inserting appropriate locking")
-#pragma message( "  if you want to use asn_GT2time() or asn_UT2time().")
-#pragma message( "PLEASE STOP AND READ!")
-
-static struct tm *localtime_r(const time_t *tloc, struct tm *result) {
-       struct tm *tm;
-       if((tm = localtime(tloc)))
-               return memcpy(result, tm, sizeof(struct tm));
-       return 0;
-}
-
-static struct tm *gmtime_r(const time_t *tloc, struct tm *result) {
-       struct tm *tm;
-       if((tm = gmtime(tloc)))
-               return memcpy(result, tm, sizeof(struct tm));
-       return 0;
-}
-
-#define        tzset() _tzset()
-#define        putenv(c)       _putenv(c)
-#define        _EMULATE_TIMEGM
-
-#endif /* _WIN32 */
-
 #if    defined(sun) || defined(__sun) || defined(__solaris__)
 #define        _EMULATE_TIMEGM
 #endif
@@ -76,14 +42,6 @@ static struct tm *gmtime_r(const time_t *tloc, struct tm *result) {
 #define        GMTOFF(tm)      (-timezone)
 #endif /* HAVE_TM_GMTOFF */
 
-#if    defined(_WIN32)
-#pragma message( "PLEASE STOP AND READ!")
-#pragma message( "  timegm() is implemented via getenv(\"TZ\")/setenv(\"TZ\"), which may be not thread-safe.")
-#pragma message( "  ")
-#pragma message( "  You must fix the code by inserting appropriate locking")
-#pragma message( "  if you want to use asn_GT2time() or asn_UT2time().")
-#pragma message( "PLEASE STOP AND READ!")
-#else
 #if    (defined(_EMULATE_TIMEGM) || !defined(HAVE_TM_GMTOFF))
 #warning "PLEASE STOP AND READ!"
 #warning "  timegm() is implemented via getenv(\"TZ\")/setenv(\"TZ\"), which may be not thread-safe."
@@ -92,29 +50,6 @@ static struct tm *gmtime_r(const time_t *tloc, struct tm *result) {
 #warning "  if you want to use asn_GT2time() or asn_UT2time()."
 #warning "PLEASE STOP AND READ!"
 #endif /* _EMULATE_TIMEGM */
-#endif
-
-/*
- * Override our GMTOFF decision for other known platforms.
- */
-#ifdef __CYGWIN__
-#undef GMTOFF
-static long GMTOFF(struct tm a){
-       struct tm *lt;
-       time_t local_time, gmt_time;
-       long zone;
-
-       tzset();
-       gmt_time = time (NULL);
-
-       lt = gmtime(&gmt_time);
-
-       local_time = mktime(lt);
-       return (gmt_time - local_time);
-}
-#define        _EMULATE_TIMEGM
-
-#endif /* __CYGWIN__ */
 
 #define        ATZVARS do {                                                    \
        char tzoldbuf[64];                                              \
index 37fa8dd0c806e4b6288e5563cfaa1932234c38a1..77d17912d5c4a2f247a6e4717c0224f1ef390eb2 100644 (file)
@@ -5,13 +5,9 @@
 #include "asn1/asn1c/asn_internal.h"
 #include "asn1/asn1c/UTCTime.h"
 #include "asn1/asn1c/GeneralizedTime.h"
-#include <errno.h>
 
-#ifdef __CYGWIN__
-#include "/usr/include/time.h"
-#else
+#include <errno.h>
 #include <time.h>
-#endif /* __CYGWIN__ */
 
 #ifndef        ASN___INTERNAL_TEST_MODE
 
index fa8cf116576e2b620cb85d35099f8bf130997721..a23ad8b68a4e377af618be702421812ea0cf4071 100644 (file)
 #include <stdarg.h>    /* For va_start */
 #include <stddef.h>    /* for offsetof and ptrdiff_t */
 
-#ifdef _WIN32
-
-#include <malloc.h>
-#define         snprintf       _snprintf
-#define         vsnprintf      _vsnprintf
-
-/* To avoid linking with ws2_32.lib, here's the definition of ntohl() */
-#define sys_ntohl(l)   ((((l) << 24)  & 0xff000000)    \
-                       | (((l) << 8) & 0xff0000)       \
-                       | (((l) >> 8)  & 0xff00)        \
-                       | ((l >> 24) & 0xff))
-
-#ifdef _MSC_VER                        /* MSVS.Net */
-#ifndef __cplusplus
-#define inline __inline
-#endif
-#ifndef        ASSUMESTDTYPES  /* Standard types have been defined elsewhere */
-#define        ssize_t         SSIZE_T
-#if _MSC_VER < 1600
-typedef        char            int8_t;
-typedef        short           int16_t;
-typedef        int             int32_t;
-typedef        unsigned char   uint8_t;
-typedef        unsigned short  uint16_t;
-typedef        unsigned int    uint32_t;
-#else /* _MSC_VER >= 1600 */
-#include <stdint.h>
-#endif /* _MSC_VER < 1600 */
-#endif /* ASSUMESTDTYPES */
-#define WIN32_LEAN_AND_MEAN
-#include <windows.h>
-#include <float.h>
-#define isnan _isnan
-#define finite _finite
-#define copysign _copysign
-#define        ilogb   _logb
-#else  /* !_MSC_VER */
-#include <stdint.h>
-#endif /* _MSC_VER */
-
-#else  /* !_WIN32 */
-
 #if defined(__vxworks)
 #include <types/vxTypes.h>
 #else  /* !defined(__vxworks) */
@@ -79,8 +37,6 @@ typedef       unsigned int    uint32_t;
 #define        sys_ntohl(foo)  ntohl(foo)
 #endif /* defined(__vxworks) */
 
-#endif /* _WIN32 */
-
 #if    __GNUC__ >= 3 || defined(__clang__)
 #define CC_ATTRIBUTE(attr)    __attribute__((attr))
 #else
index a790ea59fab924fd5b0c459c08435089be63df57..d0ac4a7f52be3a8ed3c4e509cc6b45fd7f441bd2 100644 (file)
@@ -62,22 +62,7 @@ do {
 } while (0)
 #endif
 
-/* a number of the hash function use uint32_t which isn't defined on Pre VS2010 */
-#if defined(_WIN32)
-#if defined(_MSC_VER) && _MSC_VER >= 1600
 #include <stdint.h>
-#elif defined(__WATCOMC__) || defined(__MINGW32__) || defined(__CYGWIN__)
-#include <stdint.h>
-#else
-typedef unsigned int uint32_t;
-typedef unsigned char uint8_t;
-#endif
-#elif defined(__GNUC__) && !defined(__VXWORKS__)
-#include <stdint.h>
-#else
-typedef unsigned int uint32_t;
-typedef unsigned char uint8_t;
-#endif
 
 #ifndef uthash_malloc
 #define uthash_malloc(sz) malloc(sz)      /* malloc fcn                      */