[vlc-commits] [Git][videolan/vlc][master] 3 commits: configure: use ptrdiff_t for missing ssize_t

Jean-Baptiste Kempf (@jbk) gitlab at videolan.org
Sat Jan 7 20:57:48 UTC 2023



Jean-Baptiste Kempf pushed to branch master at VideoLAN / VLC


Commits:
2be4b792 by Steve Lhomme at 2023-01-07T20:39:45+00:00
configure: use ptrdiff_t for missing ssize_t

It's closer to the definition and use of ssize_t (size_t that can hold  -1)
than a basic int.

- - - - -
e030e04e by Steve Lhomme at 2023-01-07T20:39:45+00:00
meson: define missing ssize_t and SSIZE_MAX from ptrdiff_t

ptrdiff_t is available in C11

- - - - -
15d669cc by Steve Lhomme at 2023-01-07T20:39:45+00:00
configure: add missing SSIZE_MAX when ssize_t is missing

There's no way one can exist without the other. And we need SSIZE_MAX in many
parts of the code.

- - - - -


3 changed files:

- config.h.meson
- configure.ac
- meson.build


Changes:

=====================================
config.h.meson
=====================================
@@ -634,8 +634,9 @@
 /* Define to `sa_family' if <sys/socket.h> does not define. */
 #mesondefine ss_family
 
-/* Define to `int' if <sys/types.h> does not define. */
+/* Define to `ptrdiff_t' if <sys/types.h> does not define. */
 #mesondefine ssize_t
+#mesondefine SSIZE_MAX
 
 #include <vlc_fixups.h>
 


=====================================
configure.ac
=====================================
@@ -1031,9 +1031,10 @@ fi
 AC_LANG_POP(C++)
 
 dnl LP64 and LLP64 architectures had better define ssize_t by themselves...
-AH_TEMPLATE(ssize_t, [Define to `int' if <stddef.h> does not define.]) dnl ` (fix VIM syntax highlight
+AH_TEMPLATE(ssize_t, [Define to `ptrdiff_t' if <stddef.h> does not define.]) dnl ` (fix VIM syntax highlight
 AC_CHECK_TYPE(ssize_t,, [
-  AC_DEFINE(ssize_t, int)
+  AC_DEFINE(ssize_t, ptrdiff_t)
+  AC_DEFINE([SSIZE_MAX], [PTRDIFF_MAX], [Max possible value of the ssize_t type])
 ])
 
 dnl It seems that autoconf detects pkg-config only during the first


=====================================
meson.build
=====================================
@@ -696,9 +696,10 @@ if not cc.has_type('struct ss_family', prefix: '#include <sys/socket.h>')
 endif
 
 # Check for ssize_t type
-# Define it to `int` if missing
+# Define it to `ptrdiff_t` if missing
 if not cc.has_type('ssize_t', prefix: '#include <sys/types.h>')
-    cdata.set('ssize_t', 'int')
+    cdata.set('ssize_t', 'ptrdiff_t')
+    cdata.set('SSIZE_MAX', 'PTRDIFF_MAX')
 endif
 
 # Check for struct pollfd type



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/fab6a26a9583ee55817cd90b4a68db42d2c31f21...15d669cc809d6cefc2f93ea18f2fe0047389020f

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/fab6a26a9583ee55817cd90b4a68db42d2c31f21...15d669cc809d6cefc2f93ea18f2fe0047389020f
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance


More information about the vlc-commits mailing list