Example #1
0
static void
keys_init (void)
{
  gl_tls_key_init (buffer_key, free);
  gl_tls_key_init (bufmax_key, NULL);
  /* The per-thread initial values are NULL and 0, respectively.  */
}
Example #2
0
/* Initialize buffer.  */
static void
init (void)
{
#ifdef _LIBC
  if (__libc_key_create (&key, free_key_mem))
    /* Creating the key failed.  This means something really went
       wrong.  In any case use a static buffer which is better than
       nothing.  */
    static_buf = local_buf;
#else /* !_LIBC */
  gl_tls_key_init (key, free_key_mem);

# if !HAVE_DECL_SYS_SIGLIST
  memset (_sys_siglist, 0, NSIG * sizeof *_sys_siglist);

  /* No need to use a do {} while (0) here since init_sig(...) must expand
     to a complete statement.  (We cannot use the ISO C99 designated array
     initializer syntax since it is not supported by ANSI C compilers and
     since some signal numbers might exceed NSIG.)  */
#  define init_sig(sig, abbrev, desc) \
  if (sig >= 0 && sig < NSIG) \
    _sys_siglist[sig] = desc;

#  include "siglist.h"

#  undef init_sig

# endif /* !HAVE_DECL_SYS_SIGLIST */
#endif /* !_LIBC */
}