commit 1216f7332d18248017835b1b01ded6345b51b976 (HEAD, refs/remotes/origin/master) Author: Paul Eggert Date: Mon Jul 27 23:36:48 2015 -0700 Fix subscript error in calculate_direct_scrolling Use slightly-longer cost vectors. Without this change, calculate_direct_scrolling can have a subscript violation when FRAME_LINES (frame) <= delta. * src/scroll.c (calculate_scrolling, calculate_direct_scrolling) (line_ins_del, do_line_insertion_deletion_costs): Allocate and use slightly-larger cost vectors, ones based on FRAME_TOTAL_LINES instead of FRAME_LINES. diff --git a/src/scroll.c b/src/scroll.c index ad7f0f7..7f5b73b 100644 --- a/src/scroll.c +++ b/src/scroll.c @@ -93,10 +93,10 @@ calculate_scrolling (struct frame *frame, int *draw_cost, unsigned *old_hash, unsigned *new_hash, int free_at_end) { - register int i, j; - int frame_lines = FRAME_LINES (frame); - register struct matrix_elt *p, *p1; - register int cost, cost1; + int i, j; + int frame_total_lines = FRAME_TOTAL_LINES (frame); + struct matrix_elt *p, *p1; + int cost, cost1; int lines_moved = window_size + (FRAME_SCROLL_REGION_OK (frame) ? 0 : lines_below); @@ -104,18 +104,18 @@ calculate_scrolling (struct frame *frame, at the i'th line of the lines we are considering, where I is origin 1 (as it is below). */ int *first_insert_cost - = &FRAME_INSERT_COST (frame)[frame_lines - 1 - lines_moved]; + = &FRAME_INSERT_COST (frame)[frame_total_lines - 1 - lines_moved]; int *first_delete_cost - = &FRAME_DELETE_COST (frame)[frame_lines - 1 - lines_moved]; + = &FRAME_DELETE_COST (frame)[frame_total_lines - 1 - lines_moved]; int *next_insert_cost - = &FRAME_INSERTN_COST (frame)[frame_lines - 1 - lines_moved]; + = &FRAME_INSERTN_COST (frame)[frame_total_lines - 1 - lines_moved]; int *next_delete_cost - = &FRAME_DELETEN_COST (frame)[frame_lines - 1 - lines_moved]; + = &FRAME_DELETEN_COST (frame)[frame_total_lines - 1 - lines_moved]; /* Discourage long scrolls on fast lines. Don't scroll nearly a full frame height unless it saves at least 1/4 second. */ - int extra_cost = (int) (baud_rate / (10 * 4 * FRAME_LINES (frame))); + int extra_cost = baud_rate / (10 * 4 * frame_total_lines); if (baud_rate <= 0) extra_cost = 1; @@ -433,28 +433,28 @@ calculate_direct_scrolling (struct frame *frame, unsigned *old_hash, unsigned *new_hash, int free_at_end) { - register int i, j; - int frame_lines = FRAME_LINES (frame); - register struct matrix_elt *p, *p1; - register int cost, cost1, delta; + int i, j; + int frame_total_lines = FRAME_TOTAL_LINES (frame); + struct matrix_elt *p, *p1; + int cost, cost1, delta; /* first_insert_cost[-I] is the cost of doing the first insert-line at a position I lines above the bottom line in the scroll window. */ int *first_insert_cost - = &FRAME_INSERT_COST (frame)[frame_lines - 1]; + = &FRAME_INSERT_COST (frame)[frame_total_lines - 1]; int *first_delete_cost - = &FRAME_DELETE_COST (frame)[frame_lines - 1]; + = &FRAME_DELETE_COST (frame)[frame_total_lines - 1]; int *next_insert_cost - = &FRAME_INSERTN_COST (frame)[frame_lines - 1]; + = &FRAME_INSERTN_COST (frame)[frame_total_lines - 1]; int *next_delete_cost - = &FRAME_DELETEN_COST (frame)[frame_lines - 1]; + = &FRAME_DELETEN_COST (frame)[frame_total_lines - 1]; int scroll_overhead; /* Discourage long scrolls on fast lines. Don't scroll nearly a full frame height unless it saves at least 1/4 second. */ - int extra_cost = (int) (baud_rate / (10 * 4 * FRAME_LINES (frame))); + int extra_cost = baud_rate / (10 * 4 * frame_total_lines); if (baud_rate <= 0) extra_cost = 1; @@ -894,14 +894,14 @@ scrolling_max_lines_saved (int start, int end, static void line_ins_del (struct frame *frame, int ov1, int pf1, int ovn, int pfn, - register int *ov, register int *mf) + int *ov, int *mf) { - register int i; - register int frame_lines = FRAME_LINES (frame); - register int insert_overhead = ov1 * 10; - register int next_insert_cost = ovn * 10; + int i; + int frame_total_lines = FRAME_TOTAL_LINES (frame); + int insert_overhead = ov1 * 10; + int next_insert_cost = ovn * 10; - for (i = frame_lines-1; i >= 0; i--) + for (i = frame_total_lines - 1; i >= 0; i--) { mf[i] = next_insert_cost / 10; next_insert_cost += pfn; @@ -946,12 +946,12 @@ ins_del_costs (struct frame *frame, only) and those that must repeatedly insert one line. The cost to insert N lines at line L is - [tt.t_ILov + (frame_lines + 1 - L) * tt.t_ILpf] + - N * [tt.t_ILnov + (frame_lines + 1 - L) * tt.t_ILnpf] + [tt.t_ILov + (frame_total_lines + 1 - L) * tt.t_ILpf] + + N * [tt.t_ILnov + (frame_total_lines + 1 - L) * tt.t_ILnpf] ILov represents the basic insert line overhead. ILpf is the padding required to allow the terminal time to move a line: insertion at line - L changes (frame_lines + 1 - L) lines. + L changes (frame_total_lines + 1 - L) lines. The first bracketed expression above is the overhead; the second is the multiply factor. Both are dependent only on the position at @@ -976,14 +976,15 @@ do_line_insertion_deletion_costs (struct frame *frame, const char *cleanup_string, int coefficient) { + int frame_total_lines = FRAME_TOTAL_LINES (frame); FRAME_INSERT_COST (frame) = - xnrealloc (FRAME_INSERT_COST (frame), FRAME_LINES (frame), sizeof (int)); + xnrealloc (FRAME_INSERT_COST (frame), frame_total_lines, sizeof (int)); FRAME_DELETEN_COST (frame) = - xnrealloc (FRAME_DELETEN_COST (frame), FRAME_LINES (frame), sizeof (int)); + xnrealloc (FRAME_DELETEN_COST (frame), frame_total_lines, sizeof (int)); FRAME_INSERTN_COST (frame) = - xnrealloc (FRAME_INSERTN_COST (frame), FRAME_LINES (frame), sizeof (int)); + xnrealloc (FRAME_INSERTN_COST (frame), frame_total_lines, sizeof (int)); FRAME_DELETE_COST (frame) = - xnrealloc (FRAME_DELETE_COST (frame), FRAME_LINES (frame), sizeof (int)); + xnrealloc (FRAME_DELETE_COST (frame), frame_total_lines, sizeof (int)); ins_del_costs (frame, ins_line_string, multi_ins_string, commit f5dc3cf21cf6d6f51c096262225fcb96a8a7f126 Author: Paul Eggert Date: Mon Jul 27 23:18:14 2015 -0700 Fix uninitalized value in encode_coding_object * src/coding.c (encode_coding_object): Also initialize coding->src_pos and coding->src_pos_byte when NILP (src_object). This avoids later use of uninitialized storage. diff --git a/src/coding.c b/src/coding.c index 9d1ebc8..1887560 100644 --- a/src/coding.c +++ b/src/coding.c @@ -8301,7 +8301,11 @@ encode_coding_object (struct coding_system *coding, } } else - code_conversion_save (0, 0); + { + code_conversion_save (0, 0); + coding->src_pos = from; + coding->src_pos_byte = from_byte; + } if (BUFFERP (dst_object)) { commit bb8ec488fc2d53ea0dd2a517b78d40457fb5368f Author: Xue Fuqiao Date: Tue Jul 28 08:25:33 2015 +0800 * doc/lispref/variables.texi (Variable Aliases): Typo fix. (Bug#21141) diff --git a/doc/emacs/frames.texi b/doc/emacs/frames.texi index 0667826..2ae7300 100644 --- a/doc/emacs/frames.texi +++ b/doc/emacs/frames.texi @@ -574,7 +574,7 @@ the following form: @end example @noindent -Within this format, any of the elements in braces may be omitted. +Within this format, any of the elements in brackets may be omitted. Here, @var{fontname} is the @dfn{family name} of the font, such as @samp{Monospace} or @samp{DejaVu Sans Mono}; @var{fontsize} is the @dfn{point size} of the font (one @dfn{printer's point} is about 1/72 diff --git a/doc/lispref/variables.texi b/doc/lispref/variables.texi index 27bc061..15491e5 100644 --- a/doc/lispref/variables.texi +++ b/doc/lispref/variables.texi @@ -1903,8 +1903,8 @@ the variable was first made obsolete (usually a version number string). The optional argument @var{access-type}, if non-@code{nil}, should -should specify the kind of access that will trigger obsolescence -warnings; it can be either @code{get} or @code{set}. +specify the kind of access that will trigger obsolescence warnings; it +can be either @code{get} or @code{set}. @end defun You can make two variables synonyms and declare one obsolete at the commit 2856b1dd6f0ff5164eb5a54ddfadb9963f9e9237 Author: Paul Eggert Date: Mon Jul 27 16:50:44 2015 -0700 Merge from gnulib This incorporates: 2015-07-27 time_rz: port better to MinGW 2015-07-27 time: port __need_time_t to MinGW * lib/gnulib.mk, m4/gnulib-comp.m4: Regenerate. * lib/strftime.c, lib/time.in.h, lib/time_rz.c: Copy from gnulib. * lib/time-internal.h: New file, from gnulib. diff --git a/lib/gnulib.mk b/lib/gnulib.mk index 1ca12a2..67c7e18 100644 --- a/lib/gnulib.mk +++ b/lib/gnulib.mk @@ -1640,7 +1640,7 @@ EXTRA_libgnu_a_SOURCES += time_r.c ## begin gnulib module time_rz -EXTRA_DIST += time_rz.c +EXTRA_DIST += time-internal.h time_rz.c EXTRA_libgnu_a_SOURCES += time_rz.c diff --git a/lib/strftime.c b/lib/strftime.c index c7cec26..d1ca346 100644 --- a/lib/strftime.c +++ b/lib/strftime.c @@ -30,6 +30,7 @@ # else # include "strftime.h" # endif +# include "time-internal.h" #endif #include @@ -440,6 +441,9 @@ strftime_case_ (bool upcase, STREAM_OR_CHAR_T *s, # define am_len STRLEN (a_month) # define ap_len STRLEN (ampm) #endif +#if HAVE_TZNAME + char **tzname_vec = tzname; +#endif const char *zone; size_t i = 0; STREAM_OR_CHAR_T *p = s; @@ -475,6 +479,10 @@ strftime_case_ (bool upcase, STREAM_OR_CHAR_T *s, } else { +# if !HAVE_TM_ZONE + /* Infer the zone name from *TZ instead of from TZNAME. */ + tzname_vec = tz->tzname_copy; +# endif /* POSIX.1 requires that local time zone information be used as though strftime called tzset. */ # if HAVE_TZSET @@ -483,7 +491,7 @@ strftime_case_ (bool upcase, STREAM_OR_CHAR_T *s, } /* The tzset() call might have changed the value. */ if (!(zone && *zone) && tp->tm_isdst >= 0) - zone = tzname[tp->tm_isdst != 0]; + zone = tzname_vec[tp->tm_isdst != 0]; #endif if (! zone) zone = ""; diff --git a/lib/time-internal.h b/lib/time-internal.h new file mode 100644 index 0000000..6bf3f8d --- /dev/null +++ b/lib/time-internal.h @@ -0,0 +1,49 @@ +/* Time internal interface + + Copyright 2015 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3, 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 General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, see . */ + +/* Written by Paul Eggert. */ + +/* A time zone rule. */ +struct tm_zone +{ + /* More abbreviations, should they be needed. Their TZ_IS_SET + members are zero. */ + struct tm_zone *next; + +#if HAVE_TZNAME && !HAVE_TM_ZONE + /* Copies of recent strings taken from tzname[0] and tzname[1]. + The copies are in ABBRS, so that they survive tzset. Null if unknown. */ + char *tzname_copy[2]; +#endif + + /* If nonzero, the rule represents the TZ environment variable set + to the first "abbreviation" (this may be the empty string). + Otherwise, it represents an unset TZ. */ + char tz_is_set; + + /* A sequence of null-terminated strings packed next to each other. + The strings are followed by an extra null byte. If TZ_IS_SET, + there must be at least one string and the first string (which is + actually a TZ environment value value) may be empty. Otherwise + all strings must be nonempty. + + Abbreviations are stored here because otherwise the values of + tm_zone and/or tzname would be dead after changing TZ and calling + tzset. Abbreviations never move once allocated, and are live + until tzfree is called. */ + char abbrs[FLEXIBLE_ARRAY_MEMBER]; +}; diff --git a/lib/time.in.h b/lib/time.in.h index 1adfe92..a90552c 100644 --- a/lib/time.in.h +++ b/lib/time.in.h @@ -22,13 +22,13 @@ /* Don't get in the way of glibc when it includes time.h merely to declare a few standard symbols, rather than to declare all the - symbols. Also, Solaris 8 eventually includes itself + symbols. (However, skip this for MinGW as it treats __need_time_t + incompatibly.) Also, Solaris 8 eventually includes itself recursively; if that is happening, just include the system - without adding our own declarations. MinGW system headers use - these symbols as well, but we don't want to exclude MinGW from the - 'else' branch below. */ -#if (((defined __need_time_t || defined __need_clock_t \ - || defined __need_timespec) && !defined __MINGW32__) \ + without adding our own declarations. */ +#if (((defined __need_time_t || defined __need_clock_t \ + || defined __need_timespec) \ + && !defined __MINGW32__) \ || defined _@GUARD_PREFIX@_TIME_H) # @INCLUDE_NEXT@ @NEXT_TIME_H@ diff --git a/lib/time_rz.c b/lib/time_rz.c index 8a4d7d1..cbbe2c6 100644 --- a/lib/time_rz.c +++ b/lib/time_rz.c @@ -32,35 +32,12 @@ #include #include +#include "time-internal.h" + #if !HAVE_TZSET static void tzset (void) { } #endif -/* A time zone rule. */ -struct tm_zone -{ - /* More abbreviations, should they be needed. Their TZ_IS_SET - members are zero. */ - timezone_t next; - - /* If nonzero, the rule represents the TZ environment variable set - to the first "abbreviation" (this may be the empty string). - Otherwise, it represents an unset TZ. */ - char tz_is_set; - - /* A sequence of null-terminated strings packed next to each other. - The strings are followed by an extra null byte. If TZ_IS_SET, - there must be at least one string and the first string (which is - actually a TZ environment value value) may be empty. Otherwise - all strings must be nonempty. - - Abbreviations are stored here because otherwise the values of - tm_zone and/or tzname would be dead after changing TZ and calling - tzset. Abbreviations never move once allocated, and are live - until tzfree is called. */ - char abbrs[FLEXIBLE_ARRAY_MEMBER]; -}; - /* The approximate size to use for small allocation requests. This is the largest "small" request for the GNU C library malloc. */ enum { DEFAULT_MXFAST = 64 * sizeof (size_t) / 4 }; @@ -124,39 +101,40 @@ tzalloc (char const *name) if (tz) { tz->next = NULL; +#if HAVE_TZNAME && !HAVE_TM_ZONE + tz->tzname_copy[0] = tz->tzname_copy[1] = NULL; +#endif tz->tz_is_set = !!name; extend_abbrs (tz->abbrs, name, name_size); } return tz; } -#if HAVE_TZNAME -/* If TZNAME_ADDRESS is nonnull, an assignment of a saved abbreviation. - TZNAME_ADDRESS should be either null, or &tzname[0], or &tzname[1]. - *TZNAME_ADDRESS = TZNAME_VALUE should be done after revert_tz - (indirectly) calls tzset, so that revert_tz can overwrite tzset's - assignment to tzname. Also, it should be done at the start of - the next localtime_tz or mktime_z, to undo the overwrite. */ -static char **tzname_address; -static char *tzname_value; -#endif - -/* Save into TZ any nontrivial time zone abbreviation used by TM, - and update *TM (or prepare to update tzname) if they use the abbreviation. - Return true if successful, false (setting errno) otherwise. */ +/* Save into TZ any nontrivial time zone abbreviation used by TM, and + update *TM (if HAVE_TM_ZONE) or *TZ (if !HAVE_TM_ZONE && + HAVE_TZNAME) if they use the abbreviation. Return true if + successful, false (setting errno) otherwise. */ static bool save_abbr (timezone_t tz, struct tm *tm) { #if HAVE_TM_ZONE || HAVE_TZNAME char const *zone = NULL; - char **tzname_zone = NULL; char *zone_copy = (char *) ""; + +# if HAVE_TZNAME + int tzname_index = -1; +# endif + # if HAVE_TM_ZONE zone = tm->tm_zone; # endif + # if HAVE_TZNAME if (! (zone && *zone) && 0 <= tm->tm_isdst) - zone = *(tzname_zone = &tzname[0 < tm->tm_isdst]); + { + tzname_index = tm->tm_isdst != 0; + zone = tzname[tzname_index]; + } # endif /* No need to replace null zones, or zones within the struct tm. */ @@ -196,14 +174,13 @@ save_abbr (timezone_t tz, struct tm *tm) /* Replace the zone name so that its lifetime matches that of TZ. */ # if HAVE_TM_ZONE - if (!tzname_zone) - tm->tm_zone = zone_copy; -# endif -# if HAVE_TZNAME - tzname_address = tzname_zone; - tzname_value = zone_copy; + tm->tm_zone = zone_copy; +# else + if (0 <= tzname_index) + tz->tzname_copy[tzname_index] = zone_copy; # endif #endif + return true; } @@ -292,41 +269,16 @@ revert_tz (timezone_t tz) bool ok = change_env (tz); if (!ok) saved_errno = errno; -#if HAVE_TZNAME - if (!ok) - tzname_address = NULL; - if (tzname_address) - { - char *old_value = *tzname_address; - *tzname_address = tzname_value; - tzname_value = old_value; - } -#endif tzfree (tz); errno = saved_errno; return ok; } } -/* Restore an old tzname setting that was temporarily munged by revert_tz. */ -static void -restore_tzname (void) -{ -#if HAVE_TZNAME - if (tzname_address) - { - *tzname_address = tzname_value; - tzname_address = NULL; - } -#endif -} - /* Use time zone TZ to compute localtime_r (T, TM). */ struct tm * localtime_rz (timezone_t tz, time_t const *t, struct tm *tm) { - restore_tzname (); - if (!tz) return gmtime_r (t, tm); else @@ -348,8 +300,6 @@ localtime_rz (timezone_t tz, time_t const *t, struct tm *tm) time_t mktime_z (timezone_t tz, struct tm *tm) { - restore_tzname (); - if (!tz) return timegm (tm); else diff --git a/m4/gnulib-comp.m4 b/m4/gnulib-comp.m4 index cf71d7e..c48d2e5 100644 --- a/m4/gnulib-comp.m4 +++ b/m4/gnulib-comp.m4 @@ -959,6 +959,7 @@ AC_DEFUN([gl_FILE_LIST], [ lib/sys_types.in.h lib/tempname.c lib/tempname.h + lib/time-internal.h lib/time.in.h lib/time_r.c lib/time_rz.c commit 094d5e9ef0fac319816c00cc52e0a0f2ef41be37 Author: Eli Zaretskii Date: Mon Jul 27 21:16:46 2015 +0300 Handle NULL pointers in w32heap.c allocation routines * src/w32heap.c (FREEABLE_P): Consider a NULL pointer "not freeable". (realloc_after_dump, realloc_before_dump, free_before_dump): Handle NULL pointers gracefully, as Emacs now seems to expect that. diff --git a/src/w32heap.c b/src/w32heap.c index ec5b041..60afd1d 100644 --- a/src/w32heap.c +++ b/src/w32heap.c @@ -305,9 +305,10 @@ init_heap (void) #undef free /* FREEABLE_P checks if the block can be safely freed. */ -#define FREEABLE_P(addr) \ - ((unsigned char *)(addr) < dumped_data \ - || (unsigned char *)(addr) >= dumped_data + DUMPED_HEAP_SIZE) +#define FREEABLE_P(addr) \ + ((unsigned char *)(addr) > 0 \ + && ((unsigned char *)(addr) < dumped_data \ + || (unsigned char *)(addr) >= dumped_data + DUMPED_HEAP_SIZE)) void * malloc_after_dump (size_t size) @@ -407,10 +408,10 @@ realloc_after_dump (void *ptr, size_t size) /* If the block lies in the dumped data, do not free it. Only allocate a new one. */ p = HeapAlloc (heap, 0, size); - if (p) - CopyMemory (p, ptr, size); - else + if (!p) errno = ENOMEM; + else if (ptr) + CopyMemory (p, ptr, size); } /* After dump, keep track of the "brk value" for sbrk(0). */ if (p) @@ -449,7 +450,7 @@ realloc_before_dump (void *ptr, size_t size) of failing the call as below. But this doesn't seem to be worth the added complexity, as loadup allocates only a very small number of large blocks, and never reallocates them. */ - if (p) + if (p && ptr) { CopyMemory (p, ptr, size); free_before_dump (ptr); @@ -473,6 +474,9 @@ free_after_dump (void *ptr) void free_before_dump (void *ptr) { + if (!ptr) + return; + /* Before dumping. */ if (dumped_data < (unsigned char *)ptr && (unsigned char *)ptr < bc_limit) commit 3266513eb7b7972cc63884338f821ca774a06cfa Author: Eli Zaretskii Date: Mon Jul 27 15:32:18 2015 +0300 Fix Cairo build without PNG * src/image.c: Define PNG function when USE_CAIRO is defined, even if HAVE_PNG is not. (Bug#21133) diff --git a/src/image.c b/src/image.c index cf96cae..066db74 100644 --- a/src/image.c +++ b/src/image.c @@ -5642,7 +5642,7 @@ png_image_p (Lisp_Object object) #endif /* HAVE_PNG || HAVE_NS || USE_CAIRO */ -#if defined HAVE_PNG && !defined HAVE_NS +#if (defined HAVE_PNG && !defined HAVE_NS) || defined USE_CAIRO # ifdef WINDOWSNT /* PNG library details. */ commit 70096743d5bed2c4c0221da32ebf824ad6a262c5 Author: Eli Zaretskii Date: Mon Jul 27 15:16:06 2015 +0300 MS-Windows follow-up for recent TZ-related changes * nt/mingw-cfg.site (ac_cv_header_pthread_h) (gl_cv_sys_struct_timespec_in_pthread_h): Force to "no", to avoid picking up 'struct timespec' from pthread.h, if it is installed on the user's system. We want either the definitions from MinGW system headers, if available, or the Gnulib replacements if not. * nt/inc/ms-w32.h : Don't define, as we now use lib/time.h. * lib/time.in.h: Don't let __need_* symbols affect what happens on MinGW. These symbols are defined by MinGW system headers, but we don't want that to affect whether Gnulib portions of the header are or aren't used. diff --git a/lib/time.in.h b/lib/time.in.h index a983f49..1adfe92 100644 --- a/lib/time.in.h +++ b/lib/time.in.h @@ -24,9 +24,11 @@ declare a few standard symbols, rather than to declare all the symbols. Also, Solaris 8 eventually includes itself recursively; if that is happening, just include the system - without adding our own declarations. */ -#if (defined __need_time_t || defined __need_clock_t \ - || defined __need_timespec \ + without adding our own declarations. MinGW system headers use + these symbols as well, but we don't want to exclude MinGW from the + 'else' branch below. */ +#if (((defined __need_time_t || defined __need_clock_t \ + || defined __need_timespec) && !defined __MINGW32__) \ || defined _@GUARD_PREFIX@_TIME_H) # @INCLUDE_NEXT@ @NEXT_TIME_H@ diff --git a/nt/inc/ms-w32.h b/nt/inc/ms-w32.h index bfa5bb5..4fb32df 100644 --- a/nt/inc/ms-w32.h +++ b/nt/inc/ms-w32.h @@ -306,21 +306,6 @@ int _getpid (void); #include #define tzname _tzname -/* 'struct timespec' is used by time-related functions in lib/ and - elsewhere, but we don't use lib/time.h where the structure is - defined. */ -/* MinGW64 defines 'struct timespec' and _TIMESPEC_DEFINED in sys/types.h. */ -/* Mingw.org's MinGW runtime versions 3.22 and upward define 'struct - timespec' and __struct_timespec_defined in parts/time.h, which is - included by time.h. */ -#if !defined (_TIMESPEC_DEFINED) && !defined (__struct_timespec_defined) -struct timespec -{ - time_t tv_sec; /* seconds */ - long int tv_nsec; /* nanoseconds */ -}; -#endif - /* Required for functions in lib/time_r.c, since we don't use lib/time.h. */ extern struct tm *gmtime_r (time_t const * restrict, struct tm * restrict); extern struct tm *localtime_r (time_t const * restrict, struct tm * restrict); diff --git a/nt/mingw-cfg.site b/nt/mingw-cfg.site index 0be24dd..05034fe 100644 --- a/nt/mingw-cfg.site +++ b/nt/mingw-cfg.site @@ -35,6 +35,11 @@ ac_cv_header_getopt_h=no # We don't want our struct timeval replaced due to Posix conformance gl_cv_sys_struct_timeval_tv_sec=yes +# We don't want pthread.h to be picked up just because it defines timespec +gl_cv_sys_struct_timespec_in_pthread_h=no +# Or at all... +ac_cv_header_pthread_h=no + # ACL functions are implemented in w32.c ac_cv_search_acl_get_file="none required" ac_cv_func_acl_get_file=yes