ref: 823acc68023d0d810d7d830f13da713625bc51f4
parent: 435e07d3136a39d28016e829142b70315d059719
author: Roberto E. Vargas Caballero <k0ga@shike2.com>
date: Wed Sep 26 03:11:41 EDT 2018
[lib/c] Several small fixes Cast to avoid const discard warnings are removed becuase they generated an error. Casts are dangerous since they disable all the type checking done by the compiler. At this point it is preferible to have the warning.
--- a/lib/c/bsearch.c
+++ b/lib/c/bsearch.c
@@ -6,7 +6,7 @@
{
int t;
size_t mid, low, high;
- const char *cur, *base = ary;
+ char *cur, *base = ary;
low = 0;
high = n - 1;
@@ -15,7 +15,7 @@
cur = base + mid*size;
if ((t = (*cmp)(key, cur)) == 0)
- return (void *) cur;
+ return cur;
else if (t > 0)
low = mid + 1;
else
--- a/lib/c/gmtime.c
+++ b/lib/c/gmtime.c
@@ -18,8 +18,8 @@
tm.tm_wday = (day + THU) % 7; /* 1/1/1970 was Thursday */
- for (i = EPOCH; day >= _yeardays(i); ++i)
- day -= _yeardays(i);
+ for (i = EPOCH; day >= _daysyear(i); ++i)
+ day -= _daysyear(i);
tm.tm_year = i - 1900;
tm.tm_yday = day;
--- a/lib/c/libc.h
+++ b/lib/c/libc.h
@@ -11,7 +11,7 @@
#define DEC 11
#define EPOCH 1970
-#define FEBDAYS(y) ((_yeardays(y) == 366) ? 29 : 28)
+#define FEBDAYS(y) ((_daysyear(y) == 366) ? 29 : 28)
#define SECMIN 60
#define SECHOUR (60 * SECMIN) /* 3600 */
#define SECDAY (24 * SECHOUR) /* 86400 */
@@ -27,6 +27,8 @@
int gmtoff;
int isdst;
};
+
+struct tm;
extern struct tzone *_tzone(struct tm *tm);
extern int _daysyear(int year);