]> git.ipfire.org Git - thirdparty/ntp.git/commitdiff
Merge bk://bk.ntp.org/ntp-stable
authorJuergen Perlinger <perlinger@ntp.org>
Sun, 27 Sep 2015 07:35:12 +0000 (09:35 +0200)
committerJuergen Perlinger <perlinger@ntp.org>
Sun, 27 Sep 2015 07:35:12 +0000 (09:35 +0200)
into  hydra.localnet:/home/jnperlin/Projects/Packages/NTP-DEV/src/ntp-stable-cal2

bk: 56079c30I0WW5OKe9r5rl9Tg0_homA

1  2 
ChangeLog
tests/libntp/calendar.c
tests/libntp/run-calendar.c

diff --cc ChangeLog
index 80749108c554cba1c36a51411c6b500315ffd59b,266244bf2fd850831895852799484ab0e97c5865..f58c42d68fb5db27abffe84618c319203af808e7
+++ b/ChangeLog
    be configured for the distribution targets.  Harlan Stenn.
  * [Bug 2883] ntpd crashes on exit with empty driftfile.  Miroslav Lichvar.
  * [Bug 2886] Mis-spelling: "outlyer" should be "outlier".  dave@horsfall.org
 +* [Bug 2888] streamline calendar functions.  perlinger@ntp.org
  * [Bug 2889] ntp-dev-4.3.67 does not build on Windows.  perlinger@ntp.org
  * [Bug 2890] Ignore ENOBUFS on routing netlink socket.  Konstantin Khlebnikov.
+ * [Bug 2906] make check needs better support for pthreads.  Harlan Stenn.
+ * [Bug 2907] dist* build targets require our libevent/ to be enabled.  HStenn.
  * libntp/emalloc.c: Remove explicit include of stdint.h.  Harlan Stenn.
  * Put Unity CPPFLAGS items in unity_config.h.  Harlan Stenn.
  * tests/ntpd/g_leapsec.cpp typo fix.  Harlan Stenn.
index c702a60f8a016bbe87640d78e6d9c89b68e6fd16,2d4578d0dd9576db2543cba3c4817a9fb8247a2e..036427f88e3ff0ff513914f4a233e36c470c7da4
@@@ -74,14 -103,28 +74,14 @@@ CalendarFromCalToString
  }
  
  char *
 -CalendarFromIsoToString(const struct isodate iso) {
 -
 +CalendarFromIsoToString(
 +      const struct isodate *iso)
 +{
-       char * str = malloc (sizeof (char) * 100);
+       char * str = emalloc (sizeof (char) * 100);
 -      
 -      char buffer[100] ="";
 -      snprintf(buffer, 100, "%u", iso.year);
 -      strcat(str, buffer);
 -      strcat(str, "-");
 -      snprintf(buffer, 100, "%u", (u_int)iso.week);
 -      strcat(str, buffer);
 -      strcat(str, "-");
 -      snprintf(buffer, 100, "%u", (u_int)iso.weekday);
 -      strcat(str, buffer);
 -      snprintf(buffer, 100, "%u", (u_int)iso.hour);
 -      strcat(str, buffer);
 -      strcat(str, ":");
 -      snprintf(buffer, 100, "%u", (u_int)iso.minute);
 -      strcat(str, buffer);
 -      strcat(str, ":");
 -      snprintf(buffer, 100, "%u", (u_int)iso.second);
 -      strcat(str, buffer);
 -
 +      snprintf(str, 100, "%u-W%02u-%02u %02u:%02u:%02u",
 +               iso->year, (u_int)iso->week, (u_int)iso->weekday,
 +               (u_int)iso->hour, (u_int)iso->minute, (u_int)iso->second);
 +      str[99] = '\0'; /* paranoia rulez! */
        return str;
  }
  
@@@ -127,27 -160,42 +127,27 @@@ IsEqualIso
  }
  
  char *
 -DateFromCalToString(const struct calendar cal) {
 +DateFromCalToString(
 +      const struct calendar *cal)
 +{
  
-       char * str = malloc (sizeof (char) * 100);
+       char * str = emalloc (sizeof (char) * 100);
 -      
 -      char buffer[100] ="";
 -      snprintf(buffer, 100, "%u", cal.year);
 -      strcat(str, buffer);
 -      strcat(str, "-");
 -      snprintf(buffer, 100, "%u", (u_int)cal.month);
 -      strcat(str, buffer);
 -      strcat(str, "-");
 -      snprintf(buffer, 100, "%u", (u_int)cal.monthday);
 -      strcat(str, buffer);
 -      strcat(str, " (");
 -      snprintf(buffer, 100, "%u", cal.yearday);
 -      strcat(str, buffer);
 -      strcat(str, ")");
 -      
 +      snprintf(str, 100, "%u-%02u-%02u (%u)",
 +               cal->year, (u_int)cal->month, (u_int)cal->monthday,
 +               cal->yearday);
 +      str[99] = '\0'; /* paranoia rulez! */
        return str;
  }
  
  char *
 -DateFromIsoToString(const struct isodate iso) {
 +DateFromIsoToString(
 +      const struct isodate *iso)
 +{
  
-       char * str = malloc (sizeof (char) * 100);
+       char * str = emalloc (sizeof (char) * 100);
 -      
 -      char buffer[100] ="";
 -      snprintf(buffer, 100, "%u", iso.year);
 -      strcat(str, buffer);
 -      strcat(str, "-");
 -      snprintf(buffer, 100, "%u", (u_int)iso.week);
 -      strcat(str, buffer);
 -      strcat(str, "-");
 -      snprintf(buffer, 100, "%u", (u_int)iso.weekday);
 -      strcat(str, buffer);
 -
 +      snprintf(str, 100, "%u-W%02u-%02u",
 +               iso->year, (u_int)iso->week, (u_int)iso->weekday);
 +      str[99] = '\0'; /* paranoia rulez! */
        return str;
  }
  
Simple merge