[PHP-DEV] CVS update: php3 From: zeev (php-dev <email protected>)
Date: 02/27/99

Date: Saturday February 27, 1999 @ 9:18
Author: zeev

Update of /repository/php3
In directory asf:/u/temp/cvs-serv8019

Modified Files:
        alloc.c
Log Message:
Backport the latest debugging memory manager for 3.0.7

Index: php3/alloc.c
diff -c php3/alloc.c:1.78 php3/alloc.c:1.79
*** php3/alloc.c:1.78 Sat Feb 6 06:56:45 1999
--- php3/alloc.c Sat Feb 27 09:18:20 1999
***************
*** 385,391 ****
          mem_header *p = (mem_header *) ((char *)ptr - sizeof(mem_header) - PLATFORM_PADDING);
          int no_cache_notice=0;
          int valid_beginning=1;
! int valid_end=1;
  
          if (silent==2) {
                  silent=1;
--- 385,391 ----
          mem_header *p = (mem_header *) ((char *)ptr - sizeof(mem_header) - PLATFORM_PADDING);
          int no_cache_notice=0;
          int valid_beginning=1;
! int had_problems=0;
  
          if (silent==2) {
                  silent=1;
***************
*** 395,405 ****
                  silent=0;
                  no_cache_notice=1;
          }
! if ((p->magic != MEM_BLOCK_START_MAGIC)
! && !(p->magic==MEM_BLOCK_CACHED_MAGIC && no_cache_notice)) {
! if (silent) {
! return _mem_block_check(ptr, 0, filename, lineno);
! }
                  fprintf(stderr,"---------------------------------------\n");
                  fprintf(stderr,"Block 0x%0.8lX status at %s:%d:\n", (long) p, filename, lineno);
                  fprintf(stderr,"%10s\t","Beginning: ");
--- 395,401 ----
                  silent=0;
                  no_cache_notice=1;
          }
! if (!silent) {
                  fprintf(stderr,"---------------------------------------\n");
                  fprintf(stderr,"Block 0x%0.8lX status at %s:%d:\n", (long) p, filename, lineno);
                  fprintf(stderr,"%10s\t","Beginning: ");
***************
*** 414,434 ****
                  case MEM_BLOCK_FREED_MAGIC:
                          if (!silent) {
                                  fprintf(stderr,"Freed\n");
                          } else {
                                  return _mem_block_check(ptr, 0, filename, lineno);
                          }
- valid_beginning=0;
                          break;
                  case MEM_BLOCK_CACHED_MAGIC:
- if (no_cache_notice) {
- break;
- }
                          if (!silent) {
! fprintf(stderr,"Cached (allocated on %s:%d, %d bytes)\n", p->filename, p->lineno, p->size);
                          } else {
! return _mem_block_check(ptr, 0, filename, lineno);
                          }
- valid_beginning=0;
                          break;
                  default:
                          if (!silent) {
--- 410,431 ----
                  case MEM_BLOCK_FREED_MAGIC:
                          if (!silent) {
                                  fprintf(stderr,"Freed\n");
+ had_problems=1;
                          } else {
                                  return _mem_block_check(ptr, 0, filename, lineno);
                          }
                          break;
                  case MEM_BLOCK_CACHED_MAGIC:
                          if (!silent) {
! if (!no_cache_notice) {
! fprintf(stderr,"Cached (allocated on %s:%d, %d bytes)\n", p->filename, p->lineno, p->size);
! had_problems=1;
! }
                          } else {
! if (!no_cache_notice) {
! return _mem_block_check(ptr, 0, filename, lineno);
! }
                          }
                          break;
                  default:
                          if (!silent) {
***************
*** 436,441 ****
--- 433,439 ----
                          } else {
                                  return _mem_block_check(ptr, 0, filename, lineno);
                          }
+ had_problems;
                          valid_beginning=0;
                          break;
          }
***************
*** 451,457 ****
                  if (silent) {
                          return _mem_block_check(ptr, 0, filename, lineno);
                  }
! valid_end = 0;
                  overflow_ptr = ((char *) p)+sizeof(mem_header)+p->size+PLATFORM_PADDING;
  
                  for (i=0; i<sizeof(long); i++) {
--- 449,455 ----
                  if (silent) {
                          return _mem_block_check(ptr, 0, filename, lineno);
                  }
! had_problems=1;
                  overflow_ptr = ((char *) p)+sizeof(mem_header)+p->size+PLATFORM_PADDING;
  
                  for (i=0; i<sizeof(long); i++) {
***************
*** 481,487 ****
          if (!silent) {
                  fprintf(stderr,"---------------------------------------\n");
          }
! return ((valid_end&&valid_beginning) ? 1 : 0);
  }
  
  
--- 479,485 ----
          if (!silent) {
                  fprintf(stderr,"---------------------------------------\n");
          }
! return ((!had_problems) ? 1 : 0);
  }
  
  

--
PHP Development Mailing List   http://www.php.net/
To unsubscribe send an empty message to php-dev-unsubscribe <email protected>
For help: php-dev-help <email protected>