~ubuntu-branches/ubuntu/saucy/haproxy/saucy-proposed

« back to all changes in this revision

Viewing changes to include/common/memory.h

  • Committer: Bazaar Package Importer
  • Author(s): Arnaud Cornet
  • Date: 2009-06-26 00:11:01 UTC
  • mfrom: (1.1.6 upstream) (2.1.4 squeeze)
  • Revision ID: james.westby@ubuntu.com-20090626001101-qo261ke2mjh3d8cn
* New Upstream Version (Closes: #534583).
* Add contrib directory in docs

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
  include/common/memory.h
3
3
  Memory management definitions..
4
4
 
5
 
  Copyright (C) 2000-2007 Willy Tarreau - w@1wt.eu
 
5
  Copyright (C) 2000-2008 Willy Tarreau - w@1wt.eu
6
6
  
7
7
  This library is free software; you can redistribute it and/or
8
8
  modify it under the terms of the GNU Lesser General Public
186
186
 * is written in the beginning of the memory area, so
187
187
 * there's no need for any carrier cell. This implies
188
188
 * that each memory area is at least as big as one
189
 
 * pointer.
 
189
 * pointer. Just like with the libc's free(), nothing
 
190
 * is done if <ptr> is NULL.
190
191
 */
191
192
#define pool_free2(pool, ptr)                           \
192
193
({                                                      \
193
 
        *(void **)ptr = (void *)pool->free_list;        \
194
 
        pool->free_list = (void *)ptr;                  \
195
 
        pool->used--;                                   \
 
194
        if (likely((ptr) != NULL)) {                    \
 
195
                *(void **)ptr = (void *)pool->free_list;\
 
196
                pool->free_list = (void *)ptr;          \
 
197
                pool->used--;                           \
 
198
        }                                               \
196
199
})
197
200
 
198
201