summaryrefslogtreecommitdiff
path: root/src/common
diff options
context:
space:
mode:
authorFlavioJS <FlavioJS@54d463be-8e91-2dee-dedb-b68131a5f0ec>2007-01-03 12:01:43 +0000
committerFlavioJS <FlavioJS@54d463be-8e91-2dee-dedb-b68131a5f0ec>2007-01-03 12:01:43 +0000
commite83c989677addb0eb333f9917a116549cd147bae (patch)
tree0c0d27678ca17137bac989c3766749c1d0d8b56e /src/common
parentb1f782455b315a2bce76cb8b0564a8dfd3cdc680 (diff)
downloadhercules-e83c989677addb0eb333f9917a116549cd147bae.tar.gz
hercules-e83c989677addb0eb333f9917a116549cd147bae.tar.bz2
hercules-e83c989677addb0eb333f9917a116549cd147bae.tar.xz
hercules-e83c989677addb0eb333f9917a116549cd147bae.zip
- Fixed FIFO defines in TURBO mode.
Ref: http://www.eathena.ws/board/index.php?showtopic=129766 The rest of the TURBO related errors are about the HEAD defines having to be at the start of a block because they contain a variable declaration. (i won't fix these) git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@9611 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/common')
-rw-r--r--src/common/socket.c2
-rw-r--r--src/common/socket.h11
2 files changed, 8 insertions, 5 deletions
diff --git a/src/common/socket.c b/src/common/socket.c
index ca532f185..ad33c28db 100644
--- a/src/common/socket.c
+++ b/src/common/socket.c
@@ -655,7 +655,7 @@ int do_sendrecv(int next)
free_session_mem(i); //free the bad session
continue;
}
-
+
if (!FD_ISSET(i, &readfds))
FD_SET(i,&readfds);
ret = i;
diff --git a/src/common/socket.h b/src/common/socket.h
index 71dc07ea9..370fdec5d 100644
--- a/src/common/socket.h
+++ b/src/common/socket.h
@@ -23,11 +23,13 @@ extern time_t last_tick;
extern time_t stall_time;
// define declaration
+#define TURBO
#define RFIFOSPACE(fd) (session[fd]->max_rdata-session[fd]->rdata_size)
#ifdef TURBO
-#define RFIFOHEAD(fd) char *rbPtr ## fd = session[fd]->rdata+session[fd]->rdata_pos
-#define RFIFOP(fd,pos) (&rbPtr ## fd[pos])
+#define RFIFOVAR(fd) rbPtr ## fd
+#define RFIFOHEAD(fd) uint8 *RFIFOVAR(fd) = session[fd]->rdata+session[fd]->rdata_pos
+#define RFIFOP(fd,pos) ( &RFIFOVAR(fd) + (pos) )
#else
//Make it a comment so it does not disrupts the rest of code.
#define RFIFOHEAD(fd) //
@@ -58,8 +60,9 @@ extern time_t stall_time;
#define WFIFOSPACE(fd) (session[fd]->max_wdata-session[fd]->wdata_size)
#ifdef TURBO
-#define WFIFOHEAD(fd, x) uint8 *wbPtr ## fd = (fd>0&&session[fd])?(session[fd]->wdata+session[fd]->wdata_size):NULL;
-#define WFIFOP(fd,pos) (&wbPtr ## fd[pos])
+#define WFIFOVAR(fd) wbPtr ## fd
+#define WFIFOHEAD(fd, x) uint8 *WFIFOVAR(fd) = ( (fd) > 0 && session[fd] ? session[fd]->wdata+session[fd]->wdata_size : NULL )
+#define WFIFOP(fd,pos) ( &WFIFOVAR(fd) + (pos) )
#else
#define WFIFOHEAD(fd, size) do{ if((fd) && session[fd]->wdata_size + (size) > session[fd]->max_wdata ) realloc_writefifo(fd, size); }while(0)