Back to index

tetex-bin  3.0
Functions | Variables
gc.c File Reference
#include "info.h"

Go to the source code of this file.

Functions

void add_gcable_pointer (char *pointer)
void gc_pointers (void)

Variables

static char ** gcable_pointers = (char **)NULL
static int gcable_pointers_index = 0
static int gcable_pointers_slots = 0

Function Documentation

void add_gcable_pointer ( char *  pointer)

Definition at line 35 of file gc.c.

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 45 of file gc.c.

{
  register int i, j, k;
  INFO_WINDOW *iw;
  char **new = (char **)NULL;
  int new_index = 0;
  int new_slots = 0;

  if (!info_windows || !gcable_pointers_index)
    return;

  for (i = 0; (iw = info_windows[i]); i++)
    {
      for (j = 0; j < iw->nodes_index; j++)
       {
         NODE *node = iw->nodes[j];

         /* If this node->contents appears in our list of gcable_pointers,
            it is not gc-able, so save it. */
         for (k = 0; k < gcable_pointers_index; k++)
           if (gcable_pointers[k] == node->contents)
             {
              add_pointer_to_array
                (node->contents, new_index, new, new_slots, 10, char *);
              break;
             }
       }
    }

  /* We have gathered all of the pointers which need to be saved.  Free any
     of the original pointers which do not appear in the new list. */
  for (i = 0; i < gcable_pointers_index; i++)
    {
      for (j = 0; j < new_index; j++)
       if (gcable_pointers[i] == new[j])
         break;

      /* If we got all the way through the new list, then the old pointer
        can be garbage collected. */
      if (new && !new[j])
       free (gcable_pointers[i]);
    }

  free (gcable_pointers);
  gcable_pointers = new;
  gcable_pointers_slots = new_slots;
  gcable_pointers_index = new_index;
}

Here is the call graph for this function:

Here is the caller graph for this function:


Variable Documentation

char** gcable_pointers = (char **)NULL [static]

Definition at line 27 of file gc.c.

int gcable_pointers_index = 0 [static]

Definition at line 28 of file gc.c.

int gcable_pointers_slots = 0 [static]

Definition at line 29 of file gc.c.