/***
This file is part of systemd.
Copyright 2010-2014 Lennart Poettering
Copyright 2014 Michal Schmidt
under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.
systemd is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
#include <stdint.h>
#include <stdlib.h>
#include "macro.h"
#include "mempool.h"
#include "util.h"
struct pool {
unsigned n_tiles;
unsigned n_used;
};
unsigned i;
/* When a tile is released we add it to the list and simply
* place the next pointer at its offset 0. */
void *r;
return r;
}
unsigned n;
struct pool *p;
if (!p)
return NULL;
p->n_tiles = n;
p->n_used = 0;
mp->first_pool = p;
}
}
void *p;
p = mempool_alloc_tile(mp);
if (p)
return p;
}
}
#ifdef VALGRIND
while (p) {
struct pool *n;
n = p->next;
free(p);
p = n;
}
}
#endif