diff options
author | Micael Karlberg <[email protected]> | 2019-01-31 11:34:03 +0100 |
---|---|---|
committer | Micael Karlberg <[email protected]> | 2019-02-01 17:35:53 +0100 |
commit | 875825874d4a8d52ec5cc593f5024afc696c29df (patch) | |
tree | 630ae902108597454cb9bb1670f4c14351932c5f /erts/emulator/nifs/common/socket_tarray.c | |
parent | 060338c0a6904cc4aaf5226dc7fb321ad3d23862 (diff) | |
download | otp-875825874d4a8d52ec5cc593f5024afc696c29df.tar.gz otp-875825874d4a8d52ec5cc593f5024afc696c29df.tar.bz2 otp-875825874d4a8d52ec5cc593f5024afc696c29df.zip |
[socket-nif] nosup expection of win32 and type(s) replacements
The nif callback functions (nif_open) now instead cause an
'nosup' exception if called (instead of badarg).
The basic type uint16_t, uint32_t and int32_t (C99) replaced
"own" (that is, defined by "us") types Uint16, Uint32 and
Sint32.
The point of this is that our Windows build system seems to
be a bit lacking when it comes to types...
Removed "some stuff" that was if-defed. Different solution
when win32 support for sockets has been improved.
Make sure the socket_*.c util modules are not included
in the building for windows.
OTP-15526
Diffstat (limited to 'erts/emulator/nifs/common/socket_tarray.c')
-rw-r--r-- | erts/emulator/nifs/common/socket_tarray.c | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/erts/emulator/nifs/common/socket_tarray.c b/erts/emulator/nifs/common/socket_tarray.c index a327e014c4..def22c4919 100644 --- a/erts/emulator/nifs/common/socket_tarray.c +++ b/erts/emulator/nifs/common/socket_tarray.c @@ -1,7 +1,7 @@ /* * %CopyrightBegin% * - * Copyright Ericsson AB 2018-2018. All Rights Reserved. + * Copyright Ericsson AB 2018-2019. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -24,12 +24,16 @@ * */ -#include <arpa/inet.h> +/* #ifdef HAVE_CONFIG_H */ +/* #include "config.h" */ +/* #endif */ + #include <stdio.h> #include <erl_nif.h> #include "socket_int.h" +#include <sys.h> #include "socket_util.h" #include "socket_tarray.h" @@ -40,8 +44,8 @@ */ typedef struct { - uint32_t sz; - uint32_t idx; + Uint32 sz; + Uint32 idx; ERL_NIF_TERM* array; } SocketTArrayInt; @@ -51,7 +55,7 @@ typedef struct { */ static void esock_tarray_add1(SocketTArrayInt* taP, ERL_NIF_TERM t); -static void esock_tarray_ensure_fits(SocketTArrayInt* taP, uint32_t needs); +static void esock_tarray_ensure_fits(SocketTArrayInt* taP, Uint32 needs); /* ---------------------------------------------------------------------- @@ -59,7 +63,7 @@ static void esock_tarray_ensure_fits(SocketTArrayInt* taP, uint32_t needs); */ extern -void* esock_tarray_create(uint32_t sz) +void* esock_tarray_create(Uint32 sz) { SocketTArrayInt* tarrayP; @@ -87,7 +91,7 @@ void esock_tarray_delete(SocketTArray ta) extern -uint32_t esock_tarray_sz(SocketTArray a) +Uint32 esock_tarray_sz(SocketTArray a) { return ( ((SocketTArrayInt*) a)->idx ); } @@ -125,11 +129,11 @@ void esock_tarray_add1(SocketTArrayInt* taP, ERL_NIF_TERM t) } static -void esock_tarray_ensure_fits(SocketTArrayInt* taP, uint32_t needs) +void esock_tarray_ensure_fits(SocketTArrayInt* taP, Uint32 needs) { if (taP->sz < (taP->idx + needs)) { - uint32_t newSz = (needs < taP->sz) ? 2*taP->sz : 2*needs; - void* mem = REALLOC(taP->array, newSz * sizeof(ERL_NIF_TERM)); + Uint32 newSz = (needs < taP->sz) ? 2*taP->sz : 2*needs; + void* mem = REALLOC(taP->array, newSz * sizeof(ERL_NIF_TERM)); ESOCK_ASSERT( (mem != NULL) ); |