Back to index

php5  5.3.10
Functions
init.c File Reference
#include <config.h>
#include <stdio.h>
#include <assert.h>
#include <stdlib.h>
#include <ctype.h>
#include <stdarg.h>
#include "bcmath.h"
#include "private.h"

Go to the source code of this file.

Functions

bc_num _bc_new_num_ex (int length, int scale, int persistent)
void _bc_free_num_ex (bc_num *num, int persistent)
void bc_init_numbers (TSRMLS_D)
bc_num bc_copy_num (bc_num num)
void bc_init_num (bc_num *num TSRMLS_DC)

Function Documentation

void _bc_free_num_ex ( bc_num num,
int  persistent 
)

Definition at line 81 of file init.c.

{
  if (*num == NULL) return;
  (*num)->n_refs--;
  if ((*num)->n_refs == 0) {
    if ((*num)->n_ptr)
              /* PHP Change:  free() -> pefree(), removed free_list code */
      pefree ((*num)->n_ptr, persistent);
       pefree(*num, persistent);
#if 0
    (*num)->n_next = _bc_Free_list;
    _bc_Free_list = *num;
#endif
  }
  *num = NULL;
}
bc_num _bc_new_num_ex ( int  length,
int  scale,
int  persistent 
)

Definition at line 48 of file init.c.

{
  bc_num temp;

  /* PHP Change:  malloc() -> pemalloc(), removed free_list code */
  temp = (bc_num) safe_pemalloc (1, sizeof(bc_struct)+length, scale, persistent);
#if 0
  if (_bc_Free_list != NULL) {
    temp = _bc_Free_list;
    _bc_Free_list = temp->n_next;
  } else {
    temp = (bc_num) pemalloc (sizeof(bc_struct), persistent);
    if (temp == NULL) bc_out_of_memory ();
  }
#endif
  temp->n_sign = PLUS;
  temp->n_len = length;
  temp->n_scale = scale;
  temp->n_refs = 1;
  /* PHP Change:  malloc() -> pemalloc() */
  temp->n_ptr = (char *) safe_pemalloc (1, length, scale, persistent);
  if (temp->n_ptr == NULL) bc_out_of_memory();
  temp->n_value = temp->n_ptr;
  memset (temp->n_ptr, 0, length+scale);
  return temp;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 117 of file init.c.

{
  num->n_refs++;
  return num;
}

Here is the caller graph for this function:

void bc_init_num ( bc_num *num  TSRMLS_DC)

Definition at line 127 of file init.c.

{
  *num = bc_copy_num (BCG(_zero_));
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 104 of file init.c.

{
  BCG(_zero_) = _bc_new_num_ex (1,0,1);
  BCG(_one_)  = _bc_new_num_ex (1,0,1);
  BCG(_one_)->n_value[0] = 1;
  BCG(_two_)  = _bc_new_num_ex (1,0,1);
  BCG(_two_)->n_value[0] = 2;
}

Here is the call graph for this function: