mirror of
https://github.com/nmap/nmap.git
synced 2025-12-11 02:09:03 +00:00
Indentation fixes:
$ indent -nut -i2 -kr -br -brs -brf -l0 -bad -npcs -nprs -ncs nbase_memalloc.c
This commit is contained in:
@@ -99,23 +99,23 @@
|
|||||||
#include "nbase.h"
|
#include "nbase.h"
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
static void fatal(char *fmt, ...) __attribute__ ((format (printf, 1, 2)));
|
static void fatal(char *fmt, ...) __attribute__ ((format(printf, 1, 2)));
|
||||||
|
|
||||||
static void fatal(char *fmt, ...)
|
static void fatal(char *fmt, ...) {
|
||||||
{
|
va_list ap;
|
||||||
va_list ap;
|
|
||||||
va_start(ap, fmt);
|
va_start(ap, fmt);
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
vfprintf(stderr, fmt, ap);
|
vfprintf(stderr, fmt, ap);
|
||||||
fprintf(stderr, "\nQUITTING!\n");
|
fprintf(stderr, "\nQUITTING!\n");
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void *safe_malloc(size_t size)
|
void *safe_malloc(size_t size) {
|
||||||
{
|
|
||||||
void *mymem;
|
void *mymem;
|
||||||
if ((int) size < 0) /* Catch caller errors */
|
|
||||||
|
if ((int)size < 0) /* Catch caller errors */
|
||||||
fatal("Tried to malloc negative amount of memory!!!");
|
fatal("Tried to malloc negative amount of memory!!!");
|
||||||
mymem = malloc(size);
|
mymem = malloc(size);
|
||||||
if (mymem == NULL)
|
if (mymem == NULL)
|
||||||
@@ -123,10 +123,10 @@ void *safe_malloc(size_t size)
|
|||||||
return mymem;
|
return mymem;
|
||||||
}
|
}
|
||||||
|
|
||||||
void *safe_realloc(void *ptr, size_t size)
|
void *safe_realloc(void *ptr, size_t size) {
|
||||||
{
|
|
||||||
void *mymem;
|
void *mymem;
|
||||||
if ((int) size < 0) /* Catch caller errors */
|
|
||||||
|
if ((int)size < 0) /* Catch caller errors */
|
||||||
fatal("Tried to realloc negative amount of memory!!!");
|
fatal("Tried to realloc negative amount of memory!!!");
|
||||||
mymem = realloc(ptr, size);
|
mymem = realloc(ptr, size);
|
||||||
if (mymem == NULL)
|
if (mymem == NULL)
|
||||||
@@ -135,10 +135,10 @@ void *safe_realloc(void *ptr, size_t size)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Zero-initializing version of safe_malloc */
|
/* Zero-initializing version of safe_malloc */
|
||||||
void *safe_zalloc(size_t size)
|
void *safe_zalloc(size_t size) {
|
||||||
{
|
|
||||||
void *mymem;
|
void *mymem;
|
||||||
if ((int) size < 0)
|
|
||||||
|
if ((int)size < 0)
|
||||||
fatal("Tried to malloc negative amount of memory!!!");
|
fatal("Tried to malloc negative amount of memory!!!");
|
||||||
mymem = calloc(1, size);
|
mymem = calloc(1, size);
|
||||||
if (mymem == NULL)
|
if (mymem == NULL)
|
||||||
|
|||||||
Reference in New Issue
Block a user