diff options
| author | Paul Eggert <eggert@cs.ucla.edu> | 2026-05-21 08:55:27 -0700 |
|---|---|---|
| committer | Paul Eggert <eggert@cs.ucla.edu> | 2026-05-23 19:18:53 -0700 |
| commit | 42a8e12088b4ce08262ed158b56d60fa00e8c654 (patch) | |
| tree | 07b4795efbba4ab9e46d0cf93bcca2158b5383c1 /src | |
| parent | 52ccc1b8d38906d9a30ce091a153915bbd85c945 (diff) | |
Avoid memsets in atimer.c
* src/atimer.c (start_atimer, turn_on_atimers):
Rewrite memset+assignments to xzalloc or initializers.
Diffstat (limited to 'src')
| -rw-r--r-- | src/atimer.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/atimer.c b/src/atimer.c index 72e33656b4a..e59817049f0 100644 --- a/src/atimer.c +++ b/src/atimer.c @@ -126,12 +126,12 @@ start_atimer (enum atimer_type type, struct timespec timestamp, { t = free_atimers; free_atimers = t->next; + memset (t, 0, sizeof *t); } else - t = xmalloc (sizeof *t); + t = xzalloc (sizeof *t); /* Fill the atimer structure. */ - memset (t, 0, sizeof *t); t->type = type; t->fn = fn; t->client_data = client_data; @@ -470,8 +470,7 @@ turn_on_atimers (bool on) else { #ifdef HAVE_ITIMERSPEC - struct itimerspec ispec; - memset (&ispec, 0, sizeof ispec); + struct itimerspec ispec = {0}; if (alarm_timer_ok) timer_settime (alarm_timer, TIMER_ABSTIME, &ispec, 0); # ifdef HAVE_TIMERFD |
