[vlc-commits] [Git][videolan/vlc][master] 3 commits: compat: update references

François Cartegnie (@fcartegnie) gitlab at videolan.org
Tue Jul 14 05:20:48 UTC 2026



François Cartegnie pushed to branch master at VideoLAN / VLC


Commits:
a163e420 by Rémi Denis-Courmont at 2026-07-14T07:06:34+02:00
compat: update references

POSIX 2024 is a thing these days.

- - - - -
0a45ea8b by Rémi Denis-Courmont at 2026-07-14T07:06:34+02:00
include: do not refer to gettimeofday()

That function is officially obsolescent, and we do not use it anywhere any
longer.

- - - - -
627235c9 by Rémi Denis-Courmont at 2026-07-14T07:06:34+02:00
compat: remove gettimeofday()

This is not used anywhere, as it was superseded by `timespec_get()`.

- - - - -


13 changed files:

- compat/asprintf.c
- compat/freeaddrinfo.c
- compat/gai_strerror.c
- − compat/gettimeofday.c
- compat/strlcpy.c
- compat/swab.c
- compat/vasprintf.c
- config.h.meson
- configure.ac
- include/vlc_fixups.h
- include/vlc_threads.h
- include/vlc_tick.h
- meson.build


Changes:

=====================================
compat/asprintf.c
=====================================
@@ -1,5 +1,5 @@
 /*****************************************************************************
- * asprintf.c: GNU asprintf() replacement
+ * asprintf.c: POSIX asprintf() replacement
  *****************************************************************************
  * Copyright © 1998-2009 VLC authors and VideoLAN
  *


=====================================
compat/freeaddrinfo.c
=====================================
@@ -1,5 +1,5 @@
 /*****************************************************************************
- * freeaddrinfo.c: freeaddrinfo() replacement functions
+ * freeaddrinfo.c: POSIX/IETF freeaddrinfo() replacement functions
  *****************************************************************************
  * Copyright (C) 2005 the VideoLAN team
  * Copyright (C) 2002-2007 Rémi Denis-Courmont


=====================================
compat/gai_strerror.c
=====================================
@@ -1,5 +1,5 @@
 /*****************************************************************************
- * gai_strerror.c: gai_strerror() replacement function
+ * gai_strerror.c: POSIX/IETF gai_strerror() replacement function
  *****************************************************************************
  * Copyright (C) 2005 the VideoLAN team
  * Copyright (C) 2002-2007 Rémi Denis-Courmont


=====================================
compat/gettimeofday.c deleted
=====================================
@@ -1,54 +0,0 @@
-/*****************************************************************************
- * gettimeofday.c: gettimeofday() replacement
- *****************************************************************************
- * Copyright © 2014 VLC authors and VideoLAN
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
- *****************************************************************************/
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#ifdef _WIN32
-#include <winsock2.h>
-
-/* FILETIME of Jan 1 1970 00:00:00. */
-static const unsigned __int64 epoch = 116444736000000000;
-
-/*
- * timezone information is stored outside the kernel so tzp isn't used anymore.
- *
- * Note: this function is not for Win32 high precision timing purpose. See
- * elapsed_time().
- */
-int gettimeofday(struct timeval * tp, struct timezone * tzp)
-{
-    (void)tzp;
-    FILETIME       file_time;
-    SYSTEMTIME     system_time;
-    ULARGE_INTEGER ularge;
-
-    GetSystemTime(&system_time);
-    SystemTimeToFileTime(&system_time, &file_time);
-    ularge.LowPart  = file_time.dwLowDateTime;
-    ularge.HighPart = file_time.dwHighDateTime;
-
-    tp->tv_sec  = (long) ((ularge.QuadPart - epoch) / 10000000L);
-    tp->tv_usec = (long) (system_time.wMilliseconds * 1000);
-
-    return 0;
-}
-#endif /* _WIN32 */


=====================================
compat/strlcpy.c
=====================================
@@ -1,5 +1,5 @@
 /*****************************************************************************
- * strlcpy.c: BSD strlcpy() replacement
+ * strlcpy.c: POSIX strlcpy() replacement
  *****************************************************************************
  * Copyright © 2006, 2009 Rémi Denis-Courmont
  *


=====================================
compat/swab.c
=====================================
@@ -1,5 +1,5 @@
 /*****************************************************************************
- * swab.c: swab() replacement
+ * swab.c: POSIX swab() replacement
  *****************************************************************************
  * Copyright © 2009 VLC authors and VideoLAN
  *


=====================================
compat/vasprintf.c
=====================================
@@ -1,5 +1,5 @@
 /*****************************************************************************
- * vasprintf.c: GNU vasprintf() replacement
+ * vasprintf.c: POSIX vasprintf() replacement
  *****************************************************************************
  * Copyright © 1998-2009 VLC authors and VideoLAN
  *


=====================================
config.h.meson
=====================================
@@ -176,9 +176,6 @@
 /* Define if the GNU gettext() function is already present or preinstalled. */
 #mesondefine HAVE_GETTEXT
 
-/* Define to 1 if you have the `gettimeofday' function. */
-#mesondefine HAVE_GETTIMEOFDAY
-
 /* Define to 1 if you have the <GL/wglew.h> header file. */
 #mesondefine HAVE_GL_WGLEW_H
 


=====================================
configure.ac
=====================================
@@ -849,7 +849,6 @@ need_libc=false
 dnl Check for usual libc functions
 AC_CHECK_FUNCS([accept4 dup3 fcntl flock fstatat fstatvfs fork getmntent_r getenv getpwuid_r isatty memalign mkostemp mmap open_memstream newlocale pipe2 posix_fadvise qsort_r setlocale uselocale wordexp])
 AC_REPLACE_FUNCS([aligned_alloc asprintf atof atoll dirfd fdopendir flockfile fsync getdelim getpid gmtime_r lfind lldiv localtime_r memrchr nrand48 poll posix_memalign readv recvmsg rewind sendmsg setenv strcasecmp strcasestr strdup strlcpy strndup strnlen strnstr strsep strtof strtok_r strtoll swab tdestroy tfind timegm timespec_get strverscmp vasprintf writev])
-AC_REPLACE_FUNCS([gettimeofday])
 AC_CHECK_FUNC(fdatasync,,
   [AC_DEFINE(fdatasync, fsync, [Alias fdatasync() to fsync() if missing.])
 ])


=====================================
include/vlc_fixups.h
=====================================
@@ -137,14 +137,6 @@ typedef unsigned short mode_t;
 # include <time.h> /* time_t */
 #endif
 
-#ifndef HAVE_GETTIMEOFDAY
-#ifdef _WIN32
-#include <winsock2.h>
-#else
-#include <sys/time.h>
-#endif
-#endif
-
 #ifndef HAVE_LLDIV
 typedef struct
 {
@@ -341,11 +333,6 @@ int timespec_get(struct timespec *, int);
 #endif
 
 /* sys/time.h */
-#ifndef HAVE_GETTIMEOFDAY
-struct timezone;
-int gettimeofday(struct timeval *, struct timezone *);
-#endif
-
 #if defined(WIN32) && !defined(WINSTORECOMPAT) && defined(HAVE_GETPID)
 #include <winapifamily.h>
 #if !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)


=====================================
include/vlc_threads.h
=====================================
@@ -786,7 +786,7 @@ VLC_API unsigned long vlc_thread_id(void) VLC_USED;
  *
  * \warning The origin date (time value "zero") is not specified. It is
  * typically the time the kernel started, but this is platform-dependent.
- * If you need wall clock time, use gettimeofday() instead.
+ * If you need wall clock time, use the standard timespec_get() instead.
  *
  * \return a timestamp in microseconds.
  */


=====================================
include/vlc_tick.h
=====================================
@@ -3,7 +3,7 @@
  *****************************************************************************
  * This header provides portable high precision time management functions,
  * which should be the only ones used in other segments of the program, since
- * functions like gettimeofday() and ftime() are not always supported.
+ * functions like clock_gettime() and ftime() are not always supported.
  * Most functions are declared as inline or as macros since they are only
  * interfaces to system calls and have to be called frequently.
  *****************************************************************************


=====================================
meson.build
=====================================
@@ -733,8 +733,6 @@ libcompat_functions = [
     ['asprintf',         '#include <stdio.h>'],
     ['vasprintf',        '#include <stdio.h>'],
 
-    ['gettimeofday',     '#include <sys/time.h>'],
-
     ['clock_gettime',    '#include <time.h>'],
     ['clock_nanosleep',  '#include <time.h>'],
     ['clock_getres',     '#include <time.h>'],



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/ff157804f3d23eea3fe52b84e92ed831fe6c5393...627235c90de74ae4948bd2119ca48323ce5e5d58

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/ff157804f3d23eea3fe52b84e92ed831fe6c5393...627235c90de74ae4948bd2119ca48323ce5e5d58
You're receiving this email because of your account on code.videolan.org. Manage all notifications: https://code.videolan.org/-/profile/notifications | Help: https://code.videolan.org/help




More information about the vlc-commits mailing list