summaryrefslogtreecommitdiff
path: root/src/common
diff options
context:
space:
mode:
authorultramage <ultramage@54d463be-8e91-2dee-dedb-b68131a5f0ec>2007-10-17 17:20:01 +0000
committerultramage <ultramage@54d463be-8e91-2dee-dedb-b68131a5f0ec>2007-10-17 17:20:01 +0000
commita4c3bb6153b6fd1a8d54abde6f7d9ecd593a4e4d (patch)
tree75dde2edb2807cb44b6ea17cd2f405ad66399716 /src/common
parent8982c119eaaa031bbdd70798a077c14b5bc183c1 (diff)
downloadhercules-a4c3bb6153b6fd1a8d54abde6f7d9ecd593a4e4d.tar.gz
hercules-a4c3bb6153b6fd1a8d54abde6f7d9ecd593a4e4d.tar.bz2
hercules-a4c3bb6153b6fd1a8d54abde6f7d9ecd593a4e4d.tar.xz
hercules-a4c3bb6153b6fd1a8d54abde6f7d9ecd593a4e4d.zip
Using predefined constants as parameters to the exit() function.
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@11501 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/common')
-rw-r--r--src/common/core.c2
-rw-r--r--src/common/grfio.c4
-rw-r--r--src/common/malloc.c20
-rw-r--r--src/common/mapindex.c2
-rw-r--r--src/common/socket.c12
5 files changed, 20 insertions, 20 deletions
diff --git a/src/common/core.c b/src/common/core.c
index 15cc90228..49fbcec7d 100644
--- a/src/common/core.c
+++ b/src/common/core.c
@@ -78,7 +78,7 @@ static void sig_proc(int sn)
case SIGINT:
case SIGTERM:
if (++is_called > 3)
- exit(0);
+ exit(EXIT_SUCCESS);
runflag = 0;
break;
case SIGSEGV:
diff --git a/src/common/grfio.c b/src/common/grfio.c
index 4e5da0a6a..ed2b84e3f 100644
--- a/src/common/grfio.c
+++ b/src/common/grfio.c
@@ -566,7 +566,7 @@ static int grfio_entryread(char* grfname, int gentry)
if (strlen(fname) > sizeof(aentry.fn) - 1) {
ShowFatalError("GRF file name %s is too long\n", fname);
aFree(grf_filelist);
- exit(1);
+ exit(EXIT_FAILURE);
}
srclen = 0;
if ((period_ptr = strrchr(fname, '.')) != NULL) {
@@ -637,7 +637,7 @@ static int grfio_entryread(char* grfname, int gentry)
if (strlen(fname) > sizeof(aentry.fn)-1) {
ShowFatalError("GRF file name %s is too long\n", fname);
aFree(grf_filelist);
- exit(1);
+ exit(EXIT_FAILURE);
}
ofs2 = ofs + (int)strlen(fname)+1;
type = grf_filelist[ofs2+12];
diff --git a/src/common/malloc.c b/src/common/malloc.c
index ff71a2c5e..414770156 100644
--- a/src/common/malloc.c
+++ b/src/common/malloc.c
@@ -18,7 +18,7 @@ void* aMalloc_(size_t size, const char *file, int line, const char *func)
// ShowMessage("%s:%d: in func %s: aMalloc %d\n",file,line,func,size);
if (ret == NULL){
ShowFatalError("%s:%d: in func %s: aMalloc error out of memory!\n",file,line,func);
- exit(1);
+ exit(EXIT_FAILURE);
}
return ret;
@@ -29,7 +29,7 @@ void* aMallocA_(size_t size, const char *file, int line, const char *func)
// ShowMessage("%s:%d: in func %s: aMallocA %d\n",file,line,func,size);
if (ret == NULL){
ShowFatalError("%s:%d: in func %s: aMallocA error out of memory!\n",file,line,func);
- exit(1);
+ exit(EXIT_FAILURE);
}
return ret;
@@ -40,7 +40,7 @@ void* aCalloc_(size_t num, size_t size, const char *file, int line, const char *
// ShowMessage("%s:%d: in func %s: aCalloc %d %d\n",file,line,func,num,size);
if (ret == NULL){
ShowFatalError("%s:%d: in func %s: aCalloc error out of memory!\n", file, line, func);
- exit(1);
+ exit(EXIT_FAILURE);
}
return ret;
}
@@ -50,7 +50,7 @@ void* aCallocA_(size_t num, size_t size, const char *file, int line, const char
// ShowMessage("%s:%d: in func %s: aCallocA %d %d\n",file,line,func,num,size);
if (ret == NULL){
ShowFatalError("%s:%d: in func %s: aCallocA error out of memory!\n",file,line,func);
- exit(1);
+ exit(EXIT_FAILURE);
}
return ret;
}
@@ -60,7 +60,7 @@ void* aRealloc_(void *p, size_t size, const char *file, int line, const char *fu
// ShowMessage("%s:%d: in func %s: aRealloc %p %d\n",file,line,func,p,size);
if (ret == NULL){
ShowFatalError("%s:%d: in func %s: aRealloc error out of memory!\n",file,line,func);
- exit(1);
+ exit(EXIT_FAILURE);
}
return ret;
}
@@ -70,7 +70,7 @@ char* aStrdup_(const char *p, const char *file, int line, const char *func)
// ShowMessage("%s:%d: in func %s: aStrdup %p\n",file,line,func,p);
if (ret == NULL){
ShowFatalError("%s:%d: in func %s: aStrdup error out of memory!\n", file, line, func);
- exit(1);
+ exit(EXIT_FAILURE);
}
return ret;
}
@@ -227,7 +227,7 @@ void* _mmalloc(size_t size, const char *file, int line, const char *func )
return (char *)p + sizeof(struct unit_head_large) - sizeof(int);
} else {
ShowFatalError("Memory manager::memmgr_alloc failed (allocating %d+%d bytes at %s:%d).\n", sizeof(struct unit_head_large), size, file, line);
- exit(1);
+ exit(EXIT_FAILURE);
}
}
@@ -288,7 +288,7 @@ void* _mmalloc(size_t size, const char *file, int line, const char *func )
// ここに来てはいけない。
ShowFatalError("Memory manager::memmgr_malloc() serious error (allocating %d+%d bytes at %s:%d)\n", sizeof(struct unit_head_large), size, file, line);
memmgr_info();
- exit(1);
+ exit(EXIT_FAILURE);
//return NULL;
};
@@ -485,14 +485,14 @@ static struct block* block_malloc(void)
char *pb = (char *)CALLOC(sizeof(struct block),BLOCK_ALLOC+1,file,line,func);
if(pb == NULL) {
ShowFatalError("Memory manager::block_alloc failed.\n");
- exit(1);
+ exit(EXIT_FAILURE);
}
// store original block address in chunk
chunk = (struct chunk *)MALLOC(sizeof(struct chunk),file,line,func);
if (chunk == NULL) {
ShowFatalError("Memory manager::block_alloc failed.\n");
- exit(1);
+ exit(EXIT_FAILURE);
}
chunk->block = pb;
chunk->next = (chunk_first) ? chunk_first : NULL;
diff --git a/src/common/mapindex.c b/src/common/mapindex.c
index 2fa8c9fb8..0c275c41a 100644
--- a/src/common/mapindex.c
+++ b/src/common/mapindex.c
@@ -150,7 +150,7 @@ void mapindex_init(void)
fp=fopen(mapindex_cfgfile,"r");
if(fp==NULL){
ShowFatalError("Unable to read mapindex config file %s!\n", mapindex_cfgfile);
- exit(1); //Server can't really run without this file.
+ exit(EXIT_FAILURE); //Server can't really run without this file.
}
while(fgets(line, sizeof(line), fp))
{
diff --git a/src/common/socket.c b/src/common/socket.c
index c70c0cbaa..6b52dd402 100644
--- a/src/common/socket.c
+++ b/src/common/socket.c
@@ -297,7 +297,7 @@ int make_listen_bind(uint32 ip, uint16 port)
if (fd == INVALID_SOCKET) {
ShowError("socket() creation failed (code %d)!\n", s_errno);
- exit(1);
+ exit(EXIT_FAILURE);
}
if ( fd >= FD_SETSIZE ) { //Not enough capacity for this socket
@@ -316,17 +316,17 @@ int make_listen_bind(uint32 ip, uint16 port)
result = bind(fd, (struct sockaddr*)&server_address, sizeof(server_address));
if( result == SOCKET_ERROR ) {
ShowError("bind failed (socket %d, code %d)!\n", fd, s_errno);
- exit(1);
+ exit(EXIT_FAILURE);
}
result = listen( fd, 5 );
if( result == SOCKET_ERROR ) {
ShowError("listen failed (socket %d, code %d)!\n", fd, s_errno);
- exit(1);
+ exit(EXIT_FAILURE);
}
if ( fd < 0 || fd > FD_SETSIZE )
{ //Crazy error that can happen in Windows? (info from Freya)
ShowFatalError("listen() returned invalid fd %d!\n",fd);
- exit(1);
+ exit(EXIT_FAILURE);
}
if(fd_max <= fd) fd_max = fd + 1;
@@ -469,7 +469,7 @@ int RFIFOSKIP(int fd, size_t len)
if ( s->rdata_size < s->rdata_pos + len ) {
//fprintf(stderr,"too many skip\n");
- //exit(1);
+ //exit(EXIT_FAILURE);
//better than a COMPLETE program abort // TEST! :)
ShowError("too many skip (%d) now skipped: %d (FD: %d)\n", len, RFIFOREST(fd), fd);
len = RFIFOREST(fd);
@@ -494,7 +494,7 @@ int WFIFOSET(int fd, size_t len)
fd, CONVIP(ip), len, s->wdata_size, s->max_wdata);
ShowDebug("Likely command that caused it: 0x%x\n", (*(unsigned short*)(s->wdata + s->wdata_size)));
// no other chance, make a better fifo model
- exit(1);
+ exit(EXIT_FAILURE);
}
s->wdata_size += len;