Back to index

php5  5.3.10
Defines | Functions
gdhelpers.h File Reference
#include <sys/types.h>
#include "php.h"
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Defines

#define gdCalloc(nmemb, size)   ecalloc(nmemb, size)
#define gdMalloc(size)   emalloc(size)
#define gdRealloc(ptr, size)   erealloc(ptr, size)
#define gdEstrdup(ptr)   estrdup(ptr)
#define gdFree(ptr)   efree(ptr)
#define gdPMalloc(ptr)   pemalloc(ptr, 1)
#define gdPFree(ptr)   pefree(ptr, 1)
#define gdPEstrdup(ptr)   pestrdup(ptr, 1)
#define gdMutexDeclare(x)
#define gdMutexSetup(x)
#define gdMutexShutdown(x)
#define gdMutexLock(x)
#define gdMutexUnlock(x)

Functions

char * gd_strtok_r (char *s, char *sep, char **state)
int overflow2 (int a, int b)

Define Documentation

#define gdCalloc (   nmemb,
  size 
)    ecalloc(nmemb, size)

Definition at line 15 of file gdhelpers.h.

#define gdEstrdup (   ptr)    estrdup(ptr)

Definition at line 18 of file gdhelpers.h.

#define gdFree (   ptr)    efree(ptr)

Definition at line 19 of file gdhelpers.h.

#define gdMalloc (   size)    emalloc(size)

Definition at line 16 of file gdhelpers.h.

#define gdMutexDeclare (   x)

Definition at line 38 of file gdhelpers.h.

#define gdMutexLock (   x)

Definition at line 41 of file gdhelpers.h.

#define gdMutexSetup (   x)

Definition at line 39 of file gdhelpers.h.

#define gdMutexShutdown (   x)

Definition at line 40 of file gdhelpers.h.

#define gdMutexUnlock (   x)

Definition at line 42 of file gdhelpers.h.

#define gdPEstrdup (   ptr)    pestrdup(ptr, 1)

Definition at line 22 of file gdhelpers.h.

#define gdPFree (   ptr)    pefree(ptr, 1)

Definition at line 21 of file gdhelpers.h.

#define gdPMalloc (   ptr)    pemalloc(ptr, 1)

Definition at line 20 of file gdhelpers.h.

#define gdRealloc (   ptr,
  size 
)    erealloc(ptr, size)

Definition at line 17 of file gdhelpers.h.


Function Documentation

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

Definition at line 15 of file gdhelpers.c.

{
  char separators[256];
  char *start;
  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;
    }
  start = s;
  /* 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;
}
int overflow2 ( int  a,
int  b 
)

Definition at line 20 of file gd_security.c.

{
       if(a <= 0 || b <= 0) {
              php_gd_error("gd warning: one parameter to a memory allocation multiplication is negative or zero, failing operation gracefully\n");
              return 1;
       }
       if(a > INT_MAX / b) {
              php_gd_error("gd warning: product of memory allocation multiplication would exceed INT_MAX, failing operation gracefully\n");
              return 1;
       }
       return 0;
}

Here is the call graph for this function: