summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormickey <>2001-11-01 07:00:51 +0000
committermickey <>2001-11-01 07:00:51 +0000
commit98cfa3bd8f19df13f8aefd2fd852a23cd535f945 (patch)
treef712fadd009f571477a517f910ab2a707dcc0b11
parent3067e7cb9847a7979c766c75cdffcf4ecdfad194 (diff)
downloadopenbsd-98cfa3bd8f19df13f8aefd2fd852a23cd535f945.tar.gz
openbsd-98cfa3bd8f19df13f8aefd2fd852a23cd535f945.tar.bz2
openbsd-98cfa3bd8f19df13f8aefd2fd852a23cd535f945.zip
remove dangling spaces and tabs
-rw-r--r--src/lib/libc/stdlib/malloc.c32
1 files changed, 16 insertions, 16 deletions
diff --git a/src/lib/libc/stdlib/malloc.c b/src/lib/libc/stdlib/malloc.c
index 3833bab5f9..7c98beed9d 100644
--- a/src/lib/libc/stdlib/malloc.c
+++ b/src/lib/libc/stdlib/malloc.c
@@ -8,7 +8,7 @@
8 */ 8 */
9 9
10#if defined(LIBC_SCCS) && !defined(lint) 10#if defined(LIBC_SCCS) && !defined(lint)
11static char rcsid[] = "$OpenBSD: malloc.c,v 1.43 2001/10/30 17:01:07 tdeval Exp $"; 11static char rcsid[] = "$OpenBSD: malloc.c,v 1.44 2001/11/01 07:00:51 mickey Exp $";
12#endif /* LIBC_SCCS and not lint */ 12#endif /* LIBC_SCCS and not lint */
13 13
14/* 14/*
@@ -82,7 +82,7 @@ static char rcsid[] = "$OpenBSD: malloc.c,v 1.43 2001/10/30 17:01:07 tdeval Exp
82 static spinlock_t malloc_lock = _SPINLOCK_INITIALIZER; 82 static spinlock_t malloc_lock = _SPINLOCK_INITIALIZER;
83# define THREAD_LOCK() if (__isthreaded) _SPINLOCK(&malloc_lock) 83# define THREAD_LOCK() if (__isthreaded) _SPINLOCK(&malloc_lock)
84# define THREAD_UNLOCK() if (__isthreaded) _SPINUNLOCK(&malloc_lock) 84# define THREAD_UNLOCK() if (__isthreaded) _SPINUNLOCK(&malloc_lock)
85# define THREAD_LOCK_INIT() 85# define THREAD_LOCK_INIT()
86 /* 86 /*
87 * Malloc can't use the wrapped write() if it fails very early, so 87 * Malloc can't use the wrapped write() if it fails very early, so
88 * we use the unwrapped syscall _thread_sys_write() 88 * we use the unwrapped syscall _thread_sys_write()
@@ -138,7 +138,7 @@ struct pgfree {
138 * Magic values to put in the page_directory 138 * Magic values to put in the page_directory
139 */ 139 */
140#define MALLOC_NOT_MINE ((struct pginfo*) 0) 140#define MALLOC_NOT_MINE ((struct pginfo*) 0)
141#define MALLOC_FREE ((struct pginfo*) 1) 141#define MALLOC_FREE ((struct pginfo*) 1)
142#define MALLOC_FIRST ((struct pginfo*) 2) 142#define MALLOC_FIRST ((struct pginfo*) 2)
143#define MALLOC_FOLLOW ((struct pginfo*) 3) 143#define MALLOC_FOLLOW ((struct pginfo*) 3)
144#define MALLOC_MAGIC ((struct pginfo*) 4) 144#define MALLOC_MAGIC ((struct pginfo*) 4)
@@ -186,7 +186,7 @@ static int fdzero;
186#endif 186#endif
187 187
188/* Set when initialization has been done */ 188/* Set when initialization has been done */
189static unsigned malloc_started; 189static unsigned malloc_started;
190 190
191/* Number of free pages we cache */ 191/* Number of free pages we cache */
192static unsigned malloc_cache = 16; 192static unsigned malloc_cache = 16;
@@ -320,7 +320,7 @@ malloc_dump(fd)
320 fprintf(fd, "Free: @%p [%p...%p[ %ld ->%p <-%p\n", 320 fprintf(fd, "Free: @%p [%p...%p[ %ld ->%p <-%p\n",
321 pf, pf->page, pf->end, pf->size, pf->prev, pf->next); 321 pf, pf->page, pf->end, pf->size, pf->prev, pf->next);
322 if (pf == pf->next) { 322 if (pf == pf->next) {
323 fprintf(fd, "Free_list loops.\n"); 323 fprintf(fd, "Free_list loops.\n");
324 break; 324 break;
325 } 325 }
326 } 326 }
@@ -513,7 +513,7 @@ malloc_init ()
513 if (issetugid() == 0) 513 if (issetugid() == 0)
514 p = getenv("MALLOC_OPTIONS"); 514 p = getenv("MALLOC_OPTIONS");
515 else 515 else
516 continue; 516 continue;
517 } else if (i == 2) { 517 } else if (i == 2) {
518 p = malloc_options; 518 p = malloc_options;
519 } 519 }
@@ -627,11 +627,11 @@ malloc_pages(size)
627 wrterror("(ES): zero length entry on free_list\n"); 627 wrterror("(ES): zero length entry on free_list\n");
628 if (pf->page == pf->end) 628 if (pf->page == pf->end)
629 wrterror("(ES): zero entry on free_list\n"); 629 wrterror("(ES): zero entry on free_list\n");
630 if (pf->page > pf->end) 630 if (pf->page > pf->end)
631 wrterror("(ES): sick entry on free_list\n"); 631 wrterror("(ES): sick entry on free_list\n");
632 if ((void*)pf->page >= (void*)sbrk(0)) 632 if ((void*)pf->page >= (void*)sbrk(0))
633 wrterror("(ES): entry on free_list past brk\n"); 633 wrterror("(ES): entry on free_list past brk\n");
634 if (page_dir[ptr2index(pf->page)] != MALLOC_FREE) 634 if (page_dir[ptr2index(pf->page)] != MALLOC_FREE)
635 wrterror("(ES): non-free first page on free-list\n"); 635 wrterror("(ES): non-free first page on free-list\n");
636 if (page_dir[ptr2index(pf->end)-1] != MALLOC_FREE) 636 if (page_dir[ptr2index(pf->end)-1] != MALLOC_FREE)
637 wrterror("(ES): non-free last page on free-list\n"); 637 wrterror("(ES): non-free last page on free-list\n");
@@ -647,7 +647,7 @@ malloc_pages(size)
647 pf->prev->next = pf->next; 647 pf->prev->next = pf->next;
648 delay_free = pf; 648 delay_free = pf;
649 break; 649 break;
650 } 650 }
651 651
652 p = pf->page; 652 p = pf->page;
653 pf->page = (char *)pf->page + size; 653 pf->page = (char *)pf->page + size;
@@ -915,8 +915,8 @@ irealloc(ptr, size)
915 for (osize = malloc_pagesize; *++mp == MALLOC_FOLLOW;) 915 for (osize = malloc_pagesize; *++mp == MALLOC_FOLLOW;)
916 osize += malloc_pagesize; 916 osize += malloc_pagesize;
917 917
918 if (!malloc_realloc && /* unless we have to, */ 918 if (!malloc_realloc && /* unless we have to, */
919 size <= osize && /* .. or are too small, */ 919 size <= osize && /* .. or are too small, */
920 size > (osize - malloc_pagesize)) { /* .. or can free a page, */ 920 size > (osize - malloc_pagesize)) { /* .. or can free a page, */
921 return ptr; /* don't do anything. */ 921 return ptr; /* don't do anything. */
922 } 922 }
@@ -941,8 +941,8 @@ irealloc(ptr, size)
941 osize = (*mp)->size; 941 osize = (*mp)->size;
942 942
943 if (!malloc_realloc && /* Unless we have to, */ 943 if (!malloc_realloc && /* Unless we have to, */
944 size < osize && /* ..or are too small, */ 944 size < osize && /* ..or are too small, */
945 (size > osize/2 || /* ..or could use a smaller size, */ 945 (size > osize/2 || /* ..or could use a smaller size, */
946 osize == malloc_minsize)) { /* ..(if there is one) */ 946 osize == malloc_minsize)) { /* ..(if there is one) */
947 return ptr; /* ..Don't do anything */ 947 return ptr; /* ..Don't do anything */
948 } 948 }
@@ -964,7 +964,7 @@ irealloc(ptr, size)
964 memcpy(p, ptr, size); 964 memcpy(p, ptr, size);
965 } 965 }
966 ifree(ptr); 966 ifree(ptr);
967 } 967 }
968 return p; 968 return p;
969} 969}
970 970
@@ -1074,7 +1074,7 @@ free_pages(ptr, index, info)
1074 wrterror("freelist is destroyed.\n"); 1074 wrterror("freelist is destroyed.\n");
1075 } 1075 }
1076 } 1076 }
1077 1077
1078 /* Return something to OS ? */ 1078 /* Return something to OS ? */
1079 if (!pf->next && /* If we're the last one, */ 1079 if (!pf->next && /* If we're the last one, */
1080 pf->size > malloc_cache && /* ..and the cache is full, */ 1080 pf->size > malloc_cache && /* ..and the cache is full, */
@@ -1175,7 +1175,7 @@ free_bytes(ptr, index, info)
1175 } 1175 }
1176 1176
1177 vp = info->page; /* Order is important ! */ 1177 vp = info->page; /* Order is important ! */
1178 if(vp != (void*)info) 1178 if(vp != (void*)info)
1179 ifree(info); 1179 ifree(info);
1180 ifree(vp); 1180 ifree(vp);
1181} 1181}