projects
/
pspp
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Makefiles: Make a couple of targets build more quietly.
[pspp]
/
src
/
libpspp
/
pool.c
diff --git
a/src/libpspp/pool.c
b/src/libpspp/pool.c
index 7a8a591da58a7e84ebaf6952f784cec17f7571d0..a1979abc81b5d68b5916b56c590c6dcfd3f94580 100644
(file)
--- a/
src/libpspp/pool.c
+++ b/
src/libpspp/pool.c
@@
-1,5
+1,5
@@
/* PSPP - a program for statistical analysis.
/* PSPP - a program for statistical analysis.
- Copyright (C) 2000, 2010 Free Software Foundation, Inc.
+ Copyright (C) 2000, 2010
, 2011, 2012
Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@
-26,6
+26,7
@@
#include "libpspp/temp-file.h"
#include "libpspp/str.h"
#include "libpspp/temp-file.h"
#include "libpspp/str.h"
+#include "gl/xalloc-oversized.h"
#include "gl/xalloc.h"
/* Fast, low-overhead memory block suballocator. */
#include "gl/xalloc.h"
/* Fast, low-overhead memory block suballocator. */
@@
-96,10
+97,16
@@
union align
void (*fp) (void);
long l;
double d;
void (*fp) (void);
long l;
double d;
+
+ /* glibc jmp_buf on ia64 requires 16-byte alignment. This ensures it. */
+ size_t s[2];
};
/* This should be the alignment size used by malloc(). The size of
};
/* This should be the alignment size used by malloc(). The size of
- the union above is correct, if not optimal, in all known cases. */
+ the union above is correct, if not optimal, in all known cases.
+
+ This is normally 8 bytes for 32-bit architectures and 16 bytes for 64-bit
+ architectures. */
#define ALIGN_SIZE sizeof (union align)
/* DISCRETE_BLOCKS may be declared as nonzero to prevent
#define ALIGN_SIZE sizeof (union align)
/* DISCRETE_BLOCKS may be declared as nonzero to prevent
@@
-299,7
+306,8
@@
pool_alloc (struct pool *pool, size_t amt)
void *
pool_alloc_unaligned (struct pool *pool, size_t amt)
{
void *
pool_alloc_unaligned (struct pool *pool, size_t amt)
{
- assert (pool != NULL);
+ if (pool == NULL)
+ return xmalloc (amt);
#ifndef DISCRETE_BLOCKS
/* Strings need not be aligned on any boundary, but some
#ifndef DISCRETE_BLOCKS
/* Strings need not be aligned on any boundary, but some
@@
-374,7
+382,7
@@
pool_strdup (struct pool *pool, const char *string)
strings, because the returned pointere may not be aligned
properly for other types. */
char *
strings, because the returned pointere may not be aligned
properly for other types. */
char *
-pool_
str
dup0 (struct pool *pool, const char *string, size_t size)
+pool_
mem
dup0 (struct pool *pool, const char *string, size_t size)
{
char *new_string = pool_alloc_unaligned (pool, size + 1);
memcpy (new_string, string, size);
{
char *new_string = pool_alloc_unaligned (pool, size + 1);
memcpy (new_string, string, size);
@@
-387,6
+395,9
@@
pool_strdup0 (struct pool *pool, const char *string, size_t size)
char *
pool_vasprintf (struct pool *pool, const char *format, va_list args_)
{
char *
pool_vasprintf (struct pool *pool, const char *format, va_list args_)
{
+ if (!pool)
+ return xvasprintf (format, args_);
+
struct pool_block *b;
va_list args;
int needed, avail;
struct pool_block *b;
va_list args;
int needed, avail;