~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to mysys/my_realloc.c

  • Committer: Brian Aker
  • Date: 2008-07-18 20:10:26 UTC
  • mfrom: (51.3.29 remove-dbug)
  • Revision ID: brian@tangent.org-20080718201026-tto5golt0xhwqe4a
Merging in Jay's final patch on dbug.

Show diffs side-by-side

added added

removed removed

Lines of Context:
31
31
void* my_realloc(void* oldpoint, size_t size, myf my_flags)
32
32
{
33
33
  void *point;
34
 
  DBUG_ENTER("my_realloc");
35
 
  DBUG_PRINT("my",("ptr: 0x%lx  size: %lu  my_flags: %d", (long) oldpoint,
36
 
                   (ulong) size, my_flags));
37
34
 
38
 
  DBUG_ASSERT(size > 0);
 
35
  assert(size > 0);
39
36
  if (!oldpoint && (my_flags & MY_ALLOW_ZERO_PTR))
40
 
    DBUG_RETURN(my_malloc(size,my_flags));
 
37
    return(my_malloc(size,my_flags));
41
38
#ifdef USE_HALLOC
42
39
  if (!(point = malloc(size)))
43
40
  {
44
41
    if (my_flags & MY_FREE_ON_ERROR)
45
42
      my_free(oldpoint,my_flags);
46
43
    if (my_flags & MY_HOLD_ON_ERROR)
47
 
      DBUG_RETURN(oldpoint);
 
44
      return(oldpoint);
48
45
    my_errno=errno;
49
46
    if (my_flags & MY_FAE+MY_WME)
50
47
      my_error(EE_OUTOFMEMORY, MYF(ME_BELL+ME_WAITTANG),size);
60
57
    if (my_flags & MY_FREE_ON_ERROR)
61
58
      my_free(oldpoint, my_flags);
62
59
    if (my_flags & MY_HOLD_ON_ERROR)
63
 
      DBUG_RETURN(oldpoint);
 
60
      return(oldpoint);
64
61
    my_errno=errno;
65
62
    if (my_flags & (MY_FAE+MY_WME))
66
63
      my_error(EE_OUTOFMEMORY, MYF(ME_BELL+ME_WAITTANG), size);
67
64
  }
68
65
#endif
69
 
  DBUG_PRINT("exit",("ptr: 0x%lx", (long) point));
70
 
  DBUG_RETURN(point);
 
66
  return(point);
71
67
} /* my_realloc */