summaryrefslogtreecommitdiffstats
path: root/alloca.h
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2022-02-17 20:08:16 -0800
committerKaz Kylheku <kaz@kylheku.com>2022-02-17 20:08:16 -0800
commitc27e986b91fe7db72ae87f731be84fec0e9fab53 (patch)
tree9f500b44c2641c997526b1fd659473f3d9951b85 /alloca.h
parent42e6aaefb83fafc5338c892006f8189937b0667e (diff)
downloadtxr-c27e986b91fe7db72ae87f731be84fec0e9fab53.tar.gz
txr-c27e986b91fe7db72ae87f731be84fec0e9fab53.tar.bz2
txr-c27e986b91fe7db72ae87f731be84fec0e9fab53.zip
ffi: move socket stuff to socket module.
* alloca.h (zalloca): Macro moved here from ffi.c; it's useful to any code that wants to do a zero-filled alloca, and socket.c needs it now. * ffi.c (HAVE_SOCKETS): All includes conditional on HAVE_SOCKETS removed. (zalloca): Macro removed; moved to alloca.h. (ffi_type_struct_checked, ffi_type_lookup): Static functions changed to external linkage. (ffi_type_size, ffi_type_put, ffi_type_get): New functions, used by external module that has incomplete definition of struct txr_ffi_type. (type_by_size): New static array, moved out of ffi_init_extra_types function. (ffi_type_by_size): New function. (ffi_init_extra_types): type_by_size array relocated to file scope. (sock_opt, sock_set_opt): Moved to socket.c, and adjusted to use newly developed external access to needed ffi mechanisms. (ffi_init): Numerous definitions related to sockets removed; these go to socket.c. * ffi.h (struct txr_ffi_type): Declared here now as incomplete type. (ffi_type_struct_checked, ffi_type_size, ffi_type_put, ffi_type_get, ffi_type_lookup, ffi_type_by_size): Declared. * lib.c (init): Call new function sock_init. * socket.c (sock_opt, sock_set_opt): New functions, moved from ffi.c, and slightly adapted to work with external interfaces exposed by ffi.c. (sock_init): New function. This performs unconditional initializations not keyed to the lazy loading lisplib.c mechanism. Here we create the socklen-t FFI type. FFI types lookup doesn't trigger lazy loading, so we do it this way; the alternative would be to introduce lazy load triggering to FFI type lookup, just for this one type. (sock_load_init): All the socket function and variable registrations move here from ffi_init.
Diffstat (limited to 'alloca.h')
-rw-r--r--alloca.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/alloca.h b/alloca.h
index b922c8fe..fd38f81f 100644
--- a/alloca.h
+++ b/alloca.h
@@ -37,3 +37,5 @@
#error portme
#endif
#endif
+
+#define zalloca(size) memset(alloca(size), 0, size)