Back to index

cell-binutils  2.17cvs20070401
Classes | Defines | Functions | Variables
xatexit.c File Reference
#include "ansidecl.h"
#include "libiberty.h"
#include <stdio.h>
#include <stddef.h>

Go to the source code of this file.


struct  xatexit


#define XATEXIT_SIZE   32


PTR malloc (size_t)
static void xatexit_cleanup (void)
int xatexit (void(*fn)(void))


void(* _xexit_cleanup )(void)
static struct xatexit
static struct xatexitxatexit_head = &xatexit_first

Define Documentation

#define XATEXIT_SIZE   32

Definition at line 48 of file xatexit.c.

Function Documentation

PTR malloc ( size_t  )
int xatexit ( void(*)(void)  fn)

Definition at line 67 of file xatexit.c.

  register struct xatexit *p;

  /* Tell xexit to call xatexit_cleanup.  */
  if (!_xexit_cleanup)
    _xexit_cleanup = xatexit_cleanup;

  p = xatexit_head;
  if (p->ind >= XATEXIT_SIZE)
      if ((p = (struct xatexit *) malloc (sizeof *p)) == NULL)
       return -1;
      p->ind = 0;
      p->next = xatexit_head;
      xatexit_head = p;
  p->fns[p->ind++] = fn;
  return 0;

Here is the call graph for this function:

static void xatexit_cleanup ( void  ) [static]

Definition at line 91 of file xatexit.c.

  register struct xatexit *p;
  register int n;

  for (p = xatexit_head; p; p = p->next)
    for (n = p->ind; --n >= 0;)
      (*p->fns[n]) ();

Here is the call graph for this function:

Here is the caller graph for this function:

Variable Documentation

void(* _xexit_cleanup)(void)

Definition at line 44 of file xexit.c.

struct xatexit [static]

Definition at line 58 of file xatexit.c.

struct xatexit* xatexit_head = &xatexit_first [static]

Definition at line 61 of file xatexit.c.