various: fix more lgtm scan warnings
The logger and rtwake time function changes continue the same fixes as
previous commit - use thread safe functions. The libsmartcols condition
removal is possible because width must be greater than tb->termwidth that is
size_t and cannot be smaller than zero. And remove couple FIXME's that are
old and unlikely ever to get fixed.
Reference: 3160589d86
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
This commit is contained in:
parent
5d271cefad
commit
f6b6beaf6a
|
@ -349,9 +349,6 @@ wc_truncate (wchar_t *wc, size_t width)
|
|||
return cells;
|
||||
}
|
||||
|
||||
/* FIXME: move this function to gnulib as it's missing on:
|
||||
OpenBSD 3.8, IRIX 5.3, Solaris 2.5.1, mingw, BeOS */
|
||||
|
||||
static int
|
||||
rpl_wcswidth (const wchar_t *s, size_t n)
|
||||
{
|
||||
|
@ -413,8 +410,6 @@ done:
|
|||
static char*
|
||||
mbs_align_pad (char *dest, const char* dest_end, size_t n_spaces, int padchar)
|
||||
{
|
||||
/* FIXME: Should we pad with "figure space" (\u2007)
|
||||
if non ascii data present? */
|
||||
for (/* nothing */; n_spaces && (dest < dest_end); n_spaces--)
|
||||
*dest++ = padchar;
|
||||
*dest = '\0';
|
||||
|
|
|
@ -276,26 +276,6 @@ static int parse_token(char **name, char **value, char **cp)
|
|||
return 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* Extract a tag of the form <NAME>value</NAME> from the line.
|
||||
*/
|
||||
/*
|
||||
static int parse_xml(char **name, char **value, char **cp)
|
||||
{
|
||||
char *end;
|
||||
|
||||
if (!name || !value || !cp)
|
||||
return -BLKID_ERR_PARAM;
|
||||
|
||||
*name = strip_line(*cp);
|
||||
|
||||
if ((*name)[0] != '<' || (*name)[1] == '/')
|
||||
return 0;
|
||||
|
||||
FIXME: finish this.
|
||||
}
|
||||
*/
|
||||
|
||||
/*
|
||||
* Extract a tag from the line.
|
||||
*
|
||||
|
@ -312,8 +292,7 @@ static int parse_tag(blkid_cache cache, blkid_dev dev, char **cp)
|
|||
if (!cache || !dev)
|
||||
return -BLKID_ERR_PARAM;
|
||||
|
||||
if ((ret = parse_token(&name, &value, cp)) <= 0 /* &&
|
||||
(ret = parse_xml(&name, &value, cp)) <= 0 */)
|
||||
if ((ret = parse_token(&name, &value, cp)) <= 0)
|
||||
return ret;
|
||||
|
||||
DBG(READ, ul_debug("tag: %s=\"%s\"", name, value));
|
||||
|
|
|
@ -362,7 +362,7 @@ int __scols_calculate(struct libscols_table *tb, struct libscols_buffer *buf)
|
|||
continue;
|
||||
|
||||
/* nothing to truncate */
|
||||
if (cl->width == 0 || width == 0)
|
||||
if (cl->width == 0)
|
||||
continue;
|
||||
|
||||
trunc_flag = scols_column_is_trunc(cl)
|
||||
|
|
|
@ -775,13 +775,13 @@ static void syslog_rfc5424_header(struct logger_ctl *const ctl)
|
|||
|
||||
if (ctl->rfc5424_time) {
|
||||
struct timeval tv;
|
||||
struct tm *tm;
|
||||
struct tm tm;
|
||||
|
||||
logger_gettimeofday(&tv, NULL);
|
||||
if ((tm = localtime(&tv.tv_sec)) != NULL) {
|
||||
if (localtime_r(&tv.tv_sec, &tm) != NULL) {
|
||||
char fmt[64];
|
||||
const size_t i = strftime(fmt, sizeof(fmt),
|
||||
"%Y-%m-%dT%H:%M:%S.%%06u%z ", tm);
|
||||
"%Y-%m-%dT%H:%M:%S.%%06u%z ", &tm);
|
||||
/* patch TZ info to comply with RFC3339 (we left SP at end) */
|
||||
fmt[i - 1] = fmt[i - 2];
|
||||
fmt[i - 2] = fmt[i - 3];
|
||||
|
|
|
@ -199,9 +199,10 @@ static int get_basetimes(struct rtcwake_control *ctl, int fd)
|
|||
printf("\tdelta = %ld\n", ctl->sys_time - ctl->rtc_time);
|
||||
printf("\ttzone = %ld\n", timezone);
|
||||
printf("\ttzname = %s\n", tzname[daylight]);
|
||||
gmtime_r(&ctl->rtc_time, &tm);
|
||||
gmtime_r(&ctl->sys_time, &tm);
|
||||
printf("\tsystime = %ld, (UTC) %s",
|
||||
(long) ctl->sys_time, asctime_r(gmtime(&ctl->sys_time), s));
|
||||
(long) ctl->sys_time, asctime_r(&tm, s));
|
||||
gmtime_r(&ctl->rtc_time, &tm);
|
||||
printf("\trtctime = %ld, (UTC) %s",
|
||||
(long) ctl->rtc_time, asctime_r(&tm, s));
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue