diff options
author | deraadt <> | 2014-06-27 18:17:03 +0000 |
---|---|---|
committer | deraadt <> | 2014-06-27 18:17:03 +0000 |
commit | e59a02ca48a3a8740d1a32d7123f89e9645a9edd (patch) | |
tree | af6ea78ab5e77828a961f52e4387edbff755abfe /src/lib | |
parent | 4fa180802d6415d1d7bd421678c8518d75744da2 (diff) | |
download | openbsd-e59a02ca48a3a8740d1a32d7123f89e9645a9edd.tar.gz openbsd-e59a02ca48a3a8740d1a32d7123f89e9645a9edd.tar.bz2 openbsd-e59a02ca48a3a8740d1a32d7123f89e9645a9edd.zip |
extra evil spaces snuck in over the last while
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/libc/stdlib/malloc.c | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/src/lib/libc/stdlib/malloc.c b/src/lib/libc/stdlib/malloc.c index 5d5437dc1f..efb8e76a45 100644 --- a/src/lib/libc/stdlib/malloc.c +++ b/src/lib/libc/stdlib/malloc.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: malloc.c,v 1.168 2014/06/27 17:37:42 otto Exp $ */ | 1 | /* $OpenBSD: malloc.c,v 1.169 2014/06/27 18:17:03 deraadt Exp $ */ |
2 | /* | 2 | /* |
3 | * Copyright (c) 2008, 2010, 2011 Otto Moerbeek <otto@drijf.net> | 3 | * Copyright (c) 2008, 2010, 2011 Otto Moerbeek <otto@drijf.net> |
4 | * Copyright (c) 2012 Matthew Dempsky <matthew@openbsd.org> | 4 | * Copyright (c) 2012 Matthew Dempsky <matthew@openbsd.org> |
@@ -211,7 +211,7 @@ static void malloc_exit(void); | |||
211 | /* low bits of r->p determine size: 0 means >= page size and p->size holding | 211 | /* low bits of r->p determine size: 0 means >= page size and p->size holding |
212 | * real size, otherwise r->size is a shift count, or 1 for malloc(0) | 212 | * real size, otherwise r->size is a shift count, or 1 for malloc(0) |
213 | */ | 213 | */ |
214 | #define REALSIZE(sz, r) \ | 214 | #define REALSIZE(sz, r) \ |
215 | (sz) = (uintptr_t)(r)->p & MALLOC_PAGEMASK, \ | 215 | (sz) = (uintptr_t)(r)->p & MALLOC_PAGEMASK, \ |
216 | (sz) = ((sz) == 0 ? (r)->size : ((sz) == 1 ? 0 : (1 << ((sz)-1)))) | 216 | (sz) = ((sz) == 0 ? (r)->size : ((sz) == 1 ? 0 : (1 << ((sz)-1)))) |
217 | 217 | ||
@@ -662,12 +662,12 @@ omalloc_grow(struct dir_info *d) | |||
662 | p = MMAP(newsize); | 662 | p = MMAP(newsize); |
663 | if (p == MAP_FAILED) | 663 | if (p == MAP_FAILED) |
664 | return 1; | 664 | return 1; |
665 | 665 | ||
666 | STATS_ADD(d->malloc_used, newsize); | 666 | STATS_ADD(d->malloc_used, newsize); |
667 | memset(p, 0, newsize); | 667 | memset(p, 0, newsize); |
668 | STATS_ZERO(d->inserts); | 668 | STATS_ZERO(d->inserts); |
669 | STATS_ZERO(d->insert_collisions); | 669 | STATS_ZERO(d->insert_collisions); |
670 | for (i = 0; i < d->regions_total; i++) { | 670 | for (i = 0; i < d->regions_total; i++) { |
671 | void *q = d->r[i].p; | 671 | void *q = d->r[i].p; |
672 | if (q != NULL) { | 672 | if (q != NULL) { |
673 | size_t index = hash(q) & mask; | 673 | size_t index = hash(q) & mask; |
@@ -680,7 +680,7 @@ omalloc_grow(struct dir_info *d) | |||
680 | } | 680 | } |
681 | } | 681 | } |
682 | /* avoid pages containing meta info to end up in cache */ | 682 | /* avoid pages containing meta info to end up in cache */ |
683 | if (munmap(d->r, d->regions_total * sizeof(struct region_info))) | 683 | if (munmap(d->r, d->regions_total * sizeof(struct region_info))) |
684 | wrterror("munmap", d->r); | 684 | wrterror("munmap", d->r); |
685 | else | 685 | else |
686 | STATS_SUB(d->malloc_used, | 686 | STATS_SUB(d->malloc_used, |
@@ -727,7 +727,7 @@ alloc_chunk_info(struct dir_info *d, int bits) | |||
727 | } | 727 | } |
728 | 728 | ||
729 | 729 | ||
730 | /* | 730 | /* |
731 | * The hashtable uses the assumption that p is never NULL. This holds since | 731 | * The hashtable uses the assumption that p is never NULL. This holds since |
732 | * non-MAP_FIXED mappings with hint 0 start at BRKSIZ. | 732 | * non-MAP_FIXED mappings with hint 0 start at BRKSIZ. |
733 | */ | 733 | */ |
@@ -816,7 +816,7 @@ delete(struct dir_info *d, struct region_info *ri) | |||
816 | 816 | ||
817 | } | 817 | } |
818 | } | 818 | } |
819 | 819 | ||
820 | /* | 820 | /* |
821 | * Allocate a page of chunks | 821 | * Allocate a page of chunks |
822 | */ | 822 | */ |
@@ -933,7 +933,7 @@ malloc_bytes(struct dir_info *d, size_t size, void *f) | |||
933 | lp = &bp->bits[i / MALLOC_BITS]; | 933 | lp = &bp->bits[i / MALLOC_BITS]; |
934 | if (!*lp) { | 934 | if (!*lp) { |
935 | i += MALLOC_BITS; | 935 | i += MALLOC_BITS; |
936 | i &= ~(MALLOC_BITS - 1); | 936 | i &= ~(MALLOC_BITS - 1); |
937 | if (i >= bp->total) | 937 | if (i >= bp->total) |
938 | i = 0; | 938 | i = 0; |
939 | } else | 939 | } else |
@@ -1111,7 +1111,7 @@ omalloc(size_t sz, int zero_fill, void *f) | |||
1111 | * print the error message once, to avoid making the problem | 1111 | * print the error message once, to avoid making the problem |
1112 | * potentially worse. | 1112 | * potentially worse. |
1113 | */ | 1113 | */ |
1114 | static void | 1114 | static void |
1115 | malloc_recurse(void) | 1115 | malloc_recurse(void) |
1116 | { | 1116 | { |
1117 | static int noprint; | 1117 | static int noprint; |
@@ -1252,7 +1252,7 @@ free(void *ptr) | |||
1252 | return; | 1252 | return; |
1253 | 1253 | ||
1254 | _MALLOC_LOCK(); | 1254 | _MALLOC_LOCK(); |
1255 | malloc_func = "free():"; | 1255 | malloc_func = "free():"; |
1256 | if (g_pool == NULL) { | 1256 | if (g_pool == NULL) { |
1257 | _MALLOC_UNLOCK(); | 1257 | _MALLOC_UNLOCK(); |
1258 | wrterror("free() called before allocation", NULL); | 1258 | wrterror("free() called before allocation", NULL); |
@@ -1379,9 +1379,9 @@ realloc(void *ptr, size_t size) | |||
1379 | { | 1379 | { |
1380 | void *r; | 1380 | void *r; |
1381 | int saved_errno = errno; | 1381 | int saved_errno = errno; |
1382 | 1382 | ||
1383 | _MALLOC_LOCK(); | 1383 | _MALLOC_LOCK(); |
1384 | malloc_func = "realloc():"; | 1384 | malloc_func = "realloc():"; |
1385 | if (g_pool == NULL) { | 1385 | if (g_pool == NULL) { |
1386 | if (malloc_init() != 0) | 1386 | if (malloc_init() != 0) |
1387 | return NULL; | 1387 | return NULL; |
@@ -1391,7 +1391,7 @@ realloc(void *ptr, size_t size) | |||
1391 | return NULL; | 1391 | return NULL; |
1392 | } | 1392 | } |
1393 | r = orealloc(ptr, size, CALLER); | 1393 | r = orealloc(ptr, size, CALLER); |
1394 | 1394 | ||
1395 | malloc_active--; | 1395 | malloc_active--; |
1396 | _MALLOC_UNLOCK(); | 1396 | _MALLOC_UNLOCK(); |
1397 | if (r == NULL && mopts.malloc_xmalloc) { | 1397 | if (r == NULL && mopts.malloc_xmalloc) { |
@@ -1417,7 +1417,7 @@ calloc(size_t nmemb, size_t size) | |||
1417 | int saved_errno = errno; | 1417 | int saved_errno = errno; |
1418 | 1418 | ||
1419 | _MALLOC_LOCK(); | 1419 | _MALLOC_LOCK(); |
1420 | malloc_func = "calloc():"; | 1420 | malloc_func = "calloc():"; |
1421 | if (g_pool == NULL) { | 1421 | if (g_pool == NULL) { |
1422 | if (malloc_init() != 0) | 1422 | if (malloc_init() != 0) |
1423 | return NULL; | 1423 | return NULL; |
@@ -1438,7 +1438,7 @@ calloc(size_t nmemb, size_t size) | |||
1438 | 1438 | ||
1439 | size *= nmemb; | 1439 | size *= nmemb; |
1440 | r = omalloc(size, 1, CALLER); | 1440 | r = omalloc(size, 1, CALLER); |
1441 | 1441 | ||
1442 | malloc_active--; | 1442 | malloc_active--; |
1443 | _MALLOC_UNLOCK(); | 1443 | _MALLOC_UNLOCK(); |
1444 | if (r == NULL && mopts.malloc_xmalloc) { | 1444 | if (r == NULL && mopts.malloc_xmalloc) { |
@@ -1678,7 +1678,7 @@ dump_chunk(int fd, struct chunk_info *p, void *f, int fromfreelist) | |||
1678 | p->size, p->free, p->total); | 1678 | p->size, p->free, p->total); |
1679 | write(fd, buf, strlen(buf)); | 1679 | write(fd, buf, strlen(buf)); |
1680 | if (!fromfreelist) { | 1680 | if (!fromfreelist) { |
1681 | if (p->bits[0] & 1) | 1681 | if (p->bits[0] & 1) |
1682 | putleakinfo(NULL, p->size, p->total - p->free); | 1682 | putleakinfo(NULL, p->size, p->total - p->free); |
1683 | else { | 1683 | else { |
1684 | putleakinfo(f, p->size, 1); | 1684 | putleakinfo(f, p->size, 1); |
@@ -1763,7 +1763,7 @@ malloc_dump1(int fd, struct dir_info *d) | |||
1763 | d->insert_collisions); | 1763 | d->insert_collisions); |
1764 | write(fd, buf, strlen(buf)); | 1764 | write(fd, buf, strlen(buf)); |
1765 | snprintf(buf, sizeof(buf), "Deletes %zu/%zu\n", d->deletes, | 1765 | snprintf(buf, sizeof(buf), "Deletes %zu/%zu\n", d->deletes, |
1766 | d->delete_moves); | 1766 | d->delete_moves); |
1767 | write(fd, buf, strlen(buf)); | 1767 | write(fd, buf, strlen(buf)); |
1768 | snprintf(buf, sizeof(buf), "Cheap reallocs %zu/%zu\n", | 1768 | snprintf(buf, sizeof(buf), "Cheap reallocs %zu/%zu\n", |
1769 | d->cheap_reallocs, d->cheap_realloc_tries); | 1769 | d->cheap_reallocs, d->cheap_realloc_tries); |
@@ -1784,12 +1784,12 @@ malloc_dump1(int fd, struct dir_info *d) | |||
1784 | if (realsize > MALLOC_MAXCHUNK) { | 1784 | if (realsize > MALLOC_MAXCHUNK) { |
1785 | putleakinfo(d->r[i].f, realsize, 1); | 1785 | putleakinfo(d->r[i].f, realsize, 1); |
1786 | snprintf(buf, sizeof(buf), | 1786 | snprintf(buf, sizeof(buf), |
1787 | "pages %12p %12p %zu\n", d->r[i].p, | 1787 | "pages %12p %12p %zu\n", d->r[i].p, |
1788 | d->r[i].f, realsize); | 1788 | d->r[i].f, realsize); |
1789 | write(fd, buf, strlen(buf)); | 1789 | write(fd, buf, strlen(buf)); |
1790 | } else | 1790 | } else |
1791 | dump_chunk(fd, | 1791 | dump_chunk(fd, |
1792 | (struct chunk_info *)d->r[i].size, | 1792 | (struct chunk_info *)d->r[i].size, |
1793 | d->r[i].f, 0); | 1793 | d->r[i].f, 0); |
1794 | } | 1794 | } |
1795 | } | 1795 | } |
@@ -1814,7 +1814,7 @@ malloc_dump(int fd) | |||
1814 | if (p == NULL) | 1814 | if (p == NULL) |
1815 | continue; | 1815 | continue; |
1816 | r = find(g_pool, p); | 1816 | r = find(g_pool, p); |
1817 | if (r == NULL) | 1817 | if (r == NULL) |
1818 | wrterror("bogus pointer in malloc_dump", p); | 1818 | wrterror("bogus pointer in malloc_dump", p); |
1819 | free_bytes(g_pool, r, p); | 1819 | free_bytes(g_pool, r, p); |
1820 | g_pool->delayed_chunks[i] = NULL; | 1820 | g_pool->delayed_chunks[i] = NULL; |