Back to index

php5  5.3.10
Classes | Functions | Variables
fpm_cleanup.c File Reference
#include "fpm_config.h"
#include <stdlib.h>
#include "fpm_arrays.h"
#include "fpm_cleanup.h"

Go to the source code of this file.

Classes

struct  cleanup_s

Functions

int fpm_cleanup_add (int type, void(*cleanup)(int, void *), void *arg)
void fpm_cleanups_run (int type)

Variables

static struct fpm_array_s = { .sz = sizeof(struct cleanup_s) }

Function Documentation

int fpm_cleanup_add ( int  type,
void(*)(int, void *)  cleanup,
void *  arg 
)

Definition at line 20 of file fpm_cleanup.c.

{
       struct cleanup_s *c;

       c = fpm_array_push(&cleanups);

       if (!c) {
              return -1;
       }

       c->type = type;
       c->cleanup = cleanup;
       c->arg = arg;

       return 0;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void fpm_cleanups_run ( int  type)

Definition at line 38 of file fpm_cleanup.c.

{
       struct cleanup_s *c = fpm_array_item_last(&cleanups);
       int cl = cleanups.used;

       for ( ; cl--; c--) {
              if (c->type & type) {
                     c->cleanup(type, c->arg);
              }
       }

       fpm_array_free(&cleanups);
}

Here is the call graph for this function:

Here is the caller graph for this function:


Variable Documentation

struct fpm_array_s = { .sz = sizeof(struct cleanup_s) } [static]

Definition at line 18 of file fpm_cleanup.c.