summaryrefslogtreecommitdiff
path: root/src/libstddjb/byte_zzero.c
blob: 99a5e3a481b145b7046f41c2fe85786f8586fb5a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
/* ISC license. */

#include <skalibs/sysdeps.h>

#ifdef SKALIBS_HASEXPLICIT_BZERO

#include <skalibs/nonposix.h>
#include <string.h>
#include <strings.h>
#include <skalibs/bytestr.h>

void byte_zzero (char *s, size_t n)
{
  explicit_bzero(s, n) ;
}

#else

#include <string.h>
#include <skalibs/gccattributes.h>
#include <skalibs/bytestr.h>

void _byte_zzero_hook (char *, size_t) gccattr_weak ;

gccattr_weak void _byte_zzero_hook (char *s, size_t n)
{
}

void byte_zzero (char *s, size_t n)
{
  memset(s, 0, n) ;
  _byte_zzero_hook(s, n) ;
}

#endif