Branch: Tag:

2003-03-17

2003-03-17 13:55:38 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Backported fix for infinite dmalloc loop from Pike 7.5.

Rev: src/block_alloc.h:1.29
Rev: src/pike_memory.c:1.100

1: - /* $Id: block_alloc.h,v 1.28 2001/07/04 07:02:09 hubbe Exp $ */ + /* $Id: block_alloc.h,v 1.29 2003/03/17 13:55:37 grubba Exp $ */   #undef PRE_INIT_BLOCK   #undef INIT_BLOCK   #undef EXIT_BLOCK
180:    } \   } \    \ + static inline struct DATA * \ +  PIKE_CONCAT3(just_find_,DATA)(void *ptr, size_t hval) \ + { \ +  struct DATA *p,**pp; \ +  p=PIKE_CONCAT(DATA,_hash_table)[hval]; \ +  if(!p || p->PTR_HASH_ALLOC_DATA == ptr) \ +  { \ +  return p; \ +  } \ +  while((p=p->BLOCK_ALLOC_NEXT)) \ +  { \ +  if(p->PTR_HASH_ALLOC_DATA==ptr) return p; \ +  } \ +  return 0; \ + } \    \ -  + static struct DATA *PIKE_CONCAT(just_find_,DATA)(void *ptr) \ + { \ +  struct DATA *p; \ +  size_t hval = (size_t)ptr; \ +  if(!PIKE_CONCAT(DATA,_hash_table_size)) { \ +  return 0; \ +  } \ +  hval %= PIKE_CONCAT(DATA,_hash_table_size); \ +  p=PIKE_CONCAT3(just_find_,DATA,_unlocked)(ptr, hval); \ +  return p; \ + } \ +  \ +  \   struct DATA *PIKE_CONCAT(make_,DATA)(void *ptr, size_t hval) \   { \    struct DATA *p; \