Remove all usages of bzero() and bcopy()

The bzero() and bcopy() functions are deprecated and were removed from
the POSIX standard in IEEE Std. 1003.1-2008. Remove all usages of
bzero()/bcopy() and replace them by appropriate memset()/memmove()
calls.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
This commit is contained in:
Lukas Fleischer 2012-02-19 01:19:48 +01:00
parent c17b535a33
commit 8892bb3625
5 changed files with 13 additions and 13 deletions

View File

@ -547,7 +547,7 @@ draw_weekly_view (struct window *cwin, struct date *current_day,
custom_remove_attr (cwin->p, attr); custom_remove_attr (cwin->p, attr);
/* Draw slices indicating appointment times. */ /* Draw slices indicating appointment times. */
bzero (slices, DAYSLICESNO * sizeof *slices); memset (slices, 0, DAYSLICESNO * sizeof *slices);
if (day_chk_busy_slices (date, DAYSLICESNO, slices)) if (day_chk_busy_slices (date, DAYSLICESNO, slices))
{ {
for (i = 0; i < DAYSLICESNO; i++) for (i = 0; i < DAYSLICESNO; i++)

View File

@ -383,7 +383,7 @@ ical_unformat_line (char *line)
if (strlen (line) >= BUFSIZ) if (strlen (line) >= BUFSIZ)
return NULL; return NULL;
bzero (uline, BUFSIZ); memset (uline, 0, BUFSIZ);
for (len = 0, p = line; *p; p++) for (len = 0, p = line; *p; p++)
{ {
switch (*p) switch (*p)
@ -541,7 +541,7 @@ ical_durtime2long (char *timestr)
} time; } time;
p++; p++;
bzero (&time, sizeof time); memset (&time, 0, sizeof time);
nbmatch = sscanf (p, "%uH%uM%uS", &time.hour, &time.min, &time.sec); nbmatch = sscanf (p, "%uH%uM%uS", &time.hour, &time.min, &time.sec);
if (nbmatch < 1 || nbmatch > 3) if (nbmatch < 1 || nbmatch > 3)
timelong = 0; timelong = 0;
@ -586,7 +586,7 @@ ical_dur2long (char *durstr)
unsigned week, day; unsigned week, day;
} date; } date;
bzero (&date, sizeof date); memset (&date, 0, sizeof date);
if ((p = strchr (durstr, 'P')) == NULL) if ((p = strchr (durstr, 'P')) == NULL)
durlong = NOTFOUND; durlong = NOTFOUND;
else else
@ -719,7 +719,7 @@ ical_read_rrule (FILE *log, char *rrulestr, unsigned *noskipped,
p++; p++;
rpt = mem_malloc (sizeof (ical_rpt_t)); rpt = mem_malloc (sizeof (ical_rpt_t));
bzero (rpt, sizeof (ical_rpt_t)); memset (rpt, 0, sizeof(ical_rpt_t));
if (sscanf (p, "FREQ=%s", freqstr) != 1) if (sscanf (p, "FREQ=%s", freqstr) != 1)
{ {
ical_log (log, ICAL_VEVENT, itemline, ical_log (log, ICAL_VEVENT, itemline,
@ -943,7 +943,7 @@ ical_read_event (FILE *fdi, FILE *log, unsigned *noevents, unsigned *noapoints,
int skip_alarm; int skip_alarm;
vevent_type = UNDEFINED; vevent_type = UNDEFINED;
bzero (&vevent, sizeof vevent); memset (&vevent, 0, sizeof vevent);
skip_alarm = 0; skip_alarm = 0;
while (ical_readline (fdi, buf, lstore, lineno)) while (ical_readline (fdi, buf, lstore, lineno))
{ {
@ -1128,7 +1128,7 @@ ical_read_todo (FILE *fdi, FILE *log, unsigned *notodos, unsigned *noskipped,
} vtodo; } vtodo;
int skip_alarm; int skip_alarm;
bzero (&vtodo, sizeof vtodo); memset (&vtodo, 0, sizeof vtodo);
skip_alarm = 0; skip_alarm = 0;
while (ical_readline (fdi, buf, lstore, lineno)) while (ical_readline (fdi, buf, lstore, lineno))
{ {

View File

@ -1065,7 +1065,7 @@ get_import_stream (enum export_type type)
stream = NULL; stream = NULL;
stream_name = mem_malloc (BUFSIZ); stream_name = mem_malloc (BUFSIZ);
bzero (stream_name, BUFSIZ); memset (stream_name, 0, BUFSIZ);
while (stream == NULL) while (stream == NULL)
{ {
status_mesg (ask_fname, ""); status_mesg (ask_fname, "");
@ -1124,7 +1124,7 @@ io_import_data (enum import_type type, char *stream_name)
if (stream == NULL) if (stream == NULL)
return; return;
bzero (&stats, sizeof stats); memset (&stats, 0, sizeof stats);
log = io_log_init (); log = io_log_init ();
if (log == NULL) if (log == NULL)

View File

@ -135,7 +135,7 @@ keys_init (void)
for (i = 0; i < MAXKEYVAL; i++) for (i = 0; i < MAXKEYVAL; i++)
actions[i] = KEY_UNDEF; actions[i] = KEY_UNDEF;
bzero (keys, NBKEYS); memset (keys, 0, NBKEYS);
} }
void void
@ -442,7 +442,7 @@ keys_format_label (char *key, int keylen)
if (keylen > BUFSIZ) if (keylen > BUFSIZ)
return NULL; return NULL;
bzero (fmtkey, sizeof (fmtkey)); memset (fmtkey, 0, sizeof(fmtkey));
if (len == 0) if (len == 0)
strncpy (fmtkey, "?", sizeof (fmtkey)); strncpy (fmtkey, "?", sizeof (fmtkey));
else if (len <= keylen) else if (len <= keylen)

View File

@ -205,7 +205,7 @@ dbg_calloc (size_t nmemb, size_t size, const char *pos)
if ((buf = dbg_malloc (size, pos)) == NULL) if ((buf = dbg_malloc (size, pos)) == NULL)
return NULL; return NULL;
bzero (buf, size); memset (buf, 0, size);
return buf; return buf;
} }
@ -229,7 +229,7 @@ dbg_realloc (void *ptr, size_t nmemb, size_t size, const char *pos)
old_size = *((unsigned *)ptr - EXTRA_SPACE_START + BLK_SIZE); old_size = *((unsigned *)ptr - EXTRA_SPACE_START + BLK_SIZE);
cpy_size = (old_size > new_size) ? new_size : old_size; cpy_size = (old_size > new_size) ? new_size : old_size;
bcopy (ptr, buf, cpy_size); memmove (buf, ptr, cpy_size);
mem_free (ptr); mem_free (ptr);