Back to index

tetex-bin  3.0
Defines | Functions
gdhelpers.c File Reference
#include "gd.h"
#include "gdhelpers.h"
#include <stdlib.h>
#include <string.h>

Go to the source code of this file.

Defines

#define SEP_TEST   (separators[*((unsigned char *) s)])

Functions

char * gd_strtok_r (char *s, char *sep, char **state)
voidgdCalloc (size_t nmemb, size_t size)
voidgdMalloc (size_t size)
voidgdRealloc (void *ptr, size_t size)
 BGD_DECLARE (void)

Define Documentation

#define SEP_TEST   (separators[*((unsigned char *) s)])

Definition at line 12 of file gdhelpers.c.


Function Documentation

Definition at line 94 of file gdhelpers.c.

{
  free (ptr);
}

Here is the call graph for this function:

char* gd_strtok_r ( char *  s,
char *  sep,
char **  state 
)

Definition at line 15 of file gdhelpers.c.

{
  char separators[256];
  char *result = 0;
  memset (separators, 0, sizeof (separators));
  while (*sep)
    {
      separators[*((unsigned char *) sep)] = 1;
      sep++;
    }
  if (!s)
    {
      /* Pick up where we left off */
      s = *state;
    }
  /* 1. EOS */
  if (!(*s))
    {
      *state = s;
      return 0;
    }
  /* 2. Leading separators, if any */
  if (SEP_TEST)
    {
      do
       {
         s++;
       }
      while (SEP_TEST);
      /* 2a. EOS after separators only */
      if (!(*s))
       {
         *state = s;
         return 0;
       }
    }
  /* 3. A token */
  result = s;
  do
    {
      /* 3a. Token at end of string */
      if (!(*s))
       {
         *state = s;
         return result;
       }
      s++;
    }
  while (!SEP_TEST);
  /* 4. Terminate token and skip trailing separators */
  *s = '\0';
  do
    {
      s++;
    }
  while (SEP_TEST);
  /* 5. Return token */
  *state = s;
  return result;
}

Here is the caller graph for this function:

void* gdCalloc ( size_t  nmemb,
size_t  size 
)

Definition at line 77 of file gdhelpers.c.

{
  return calloc (nmemb, size);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void* gdMalloc ( size_t  size)

Definition at line 83 of file gdhelpers.c.

{
  return malloc (size);
}

Here is the caller graph for this function:

void* gdRealloc ( void ptr,
size_t  size 
)

Definition at line 89 of file gdhelpers.c.

{
  return realloc (ptr, size);
}

Here is the call graph for this function:

Here is the caller graph for this function: