~ubuntu-branches/ubuntu/maverick/bind9/maverick

« back to all changes in this revision

Viewing changes to lib/isc/heap.c

  • Committer: Bazaar Package Importer
  • Author(s): LaMont Jones
  • Date: 2005-04-19 10:21:58 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20050419102158-kp20cp1bqf4ivpzy
Tags: 1:9.3.1-2ubuntu1
resync with debian

Show diffs side-by-side

added added

removed removed

Lines of Context:
15
15
 * PERFORMANCE OF THIS SOFTWARE.
16
16
 */
17
17
 
18
 
/* $Id: heap.c,v 1.28.2.1 2004/03/09 06:11:46 marka Exp $ */
 
18
/* $Id: heap.c,v 1.28.12.3 2004/03/08 09:04:48 marka Exp $ */
19
19
 
20
20
/*
21
21
 * Heap implementation of priority queues adapted from the following:
78
78
        REQUIRE(heapp != NULL && *heapp == NULL);
79
79
        REQUIRE(compare != NULL);
80
80
 
81
 
        heap = isc_mem_get(mctx, sizeof *heap);
 
81
        heap = isc_mem_get(mctx, sizeof(*heap));
82
82
        if (heap == NULL)
83
83
                return (ISC_R_NOMEMORY);
84
84
        heap->magic = HEAP_MAGIC;
108
108
 
109
109
        if (heap->array != NULL)
110
110
                isc_mem_put(heap->mctx, heap->array,
111
 
                            heap->size * sizeof (void *));
 
111
                            heap->size * sizeof(void *));
112
112
        heap->magic = 0;
113
 
        isc_mem_put(heap->mctx, heap, sizeof *heap);
 
113
        isc_mem_put(heap->mctx, heap, sizeof(*heap));
114
114
 
115
115
        *heapp = NULL;
116
116
}
123
123
        REQUIRE(VALID_HEAP(heap));
124
124
 
125
125
        new_size = heap->size + heap->size_increment;
126
 
        new_array = isc_mem_get(heap->mctx, new_size * sizeof (void *));
 
126
        new_array = isc_mem_get(heap->mctx, new_size * sizeof(void *));
127
127
        if (new_array == NULL)
128
128
                return (ISC_FALSE);
129
129
        if (heap->array != NULL) {
130
 
                memcpy(new_array, heap->array, heap->size * sizeof (void *));
 
130
                memcpy(new_array, heap->array, heap->size * sizeof(void *));
131
131
                isc_mem_put(heap->mctx, heap->array,
132
 
                            heap->size * sizeof (void *));
 
132
                            heap->size * sizeof(void *));
133
133
        }
134
134
        heap->size = new_size;
135
135
        heap->array = new_array;