skalibs

Mirror/fork of https://skarnet.org/software/skalibs/
git clone https://ccx.te2000.cz/git/skalibs
Log | Files | Refs | README | LICENSE

byte_zzero.c (553B)


      1 /* ISC license. */
      2 
      3 #include <skalibs/sysdeps.h>
      4 
      5 #ifdef SKALIBS_HASEXPLICIT_BZERO
      6 
      7 #include <skalibs/nonposix.h>
      8 #include <string.h>
      9 #include <strings.h>
     10 #include <skalibs/bytestr.h>
     11 
     12 void byte_zzero (char *s, size_t n)
     13 {
     14   explicit_bzero(s, n) ;
     15 }
     16 
     17 #else
     18 
     19 #include <string.h>
     20 #include <skalibs/gccattributes.h>
     21 #include <skalibs/bytestr.h>
     22 
     23 void _byte_zzero_hook (char *, size_t) gccattr_weak ;
     24 
     25 gccattr_weak void _byte_zzero_hook (char *s, size_t n)
     26 {
     27 }
     28 
     29 void byte_zzero (char *s, size_t n)
     30 {
     31   memset(s, 0, n) ;
     32   _byte_zzero_hook(s, n) ;
     33 }
     34 
     35 #endif