sas Tue Dec 3 19:19:52 2002 EDT
Modified files:
/php4/ext/ircg ircg.c
Log:
restore inline allocation of write buffer
Index: php4/ext/ircg/ircg.c
diff -u php4/ext/ircg/ircg.c:1.152 php4/ext/ircg/ircg.c:1.153
--- php4/ext/ircg/ircg.c:1.152 Tue Dec 3 16:50:12 2002
+++ php4/ext/ircg/ircg.c Tue Dec 3 19:19:51 2002
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: ircg.c,v 1.152 2002/12/03 21:50:12 sas Exp $ */
+/* $Id: ircg.c,v 1.153 2002/12/04 00:19:51 sas Exp $ */
/* {{{ includes */
@@ -190,10 +190,7 @@
struct sockaddr_in sin; /* address of stream conn */
#endif
php_fmt_msgs_t *fmt_msgs;
-#if IRCG_API_VERSION < 20021127
irc_write_buf wb;
-#endif
- irc_write_buf *wbp;
ircg_hash_table ctcp_msgs;
#ifdef IRCG_PENDING_URL
@@ -363,8 +360,8 @@
if (is_my_conn(conn))
shutdown(conn->fd, 2);
#endif
- if (conn->file_fd == -1 && conn->fd >= 0)
- irc_write_buf_del(conn->wbp);
+ if (conn->file_fd == -1)
+ irc_write_buf_del(&conn->wb);
}
if (conn->file_fd != -1) {
smart_str m = {0};
@@ -466,7 +463,7 @@
goto done;
default:
#if IRCG_API_VERSION - 0 >= 20010601
- if ((n = irc_write_buf_append_ex(conn->wbp, msg, 0))) {
+ if ((n = irc_write_buf_append_ex(&conn->wb, msg, 0))) {
const char *reason;
#if IRCG_API_VERSION - 0 >= 20020308
@@ -494,10 +491,10 @@
}
return;
#elif IRCG_API_VERSION - 0 >= 20010302
- irc_write_buf_append_ex(conn->wbp, msg, 0); /* no copy */
+ irc_write_buf_append_ex(&conn->wb, msg, 0); /* no copy */
return;
#else
- irc_write_buf_append(conn->wbp, msg);
+ irc_write_buf_append(&conn->wb, msg);
goto done;
#endif
break;
@@ -512,7 +509,7 @@
{
msg_accum_send(conn, msg);
if (conn->fd >= 0 && conn->file_fd == -1)
- irc_write_buf_flush(conn->wbp);
+ irc_write_buf_flush(&conn->wb);
}
static void msg_replay_buffer(php_irconn_t *conn)
@@ -895,8 +892,8 @@
smart_str tmp = {0};
smart_str_setl(&tmp, " ", 2);
- irc_write_buf_append_ex(conn->wbp, &tmp, 1);
- irc_write_buf_flush(conn->wbp);
+ irc_write_buf_append_ex(&conn->wb, &tmp, 1);
+ irc_write_buf_flush(&conn->wb);
} else if (conn->file_fd < 0
&& (php_ircg_now() - conn->login) > WINDOW_TIMEOUT) {
char buf[1024];
@@ -1079,7 +1076,7 @@
ircg_hash_index_del(&h_fd2irconn, conn->fd);
#endif
if (conn->file_fd == -1)
- irc_write_buf_del(conn->wbp);
+ irc_write_buf_del(&conn->wb);
conn->fd = -1;
}
@@ -1099,18 +1096,14 @@
sizeof(int), NULL);
#endif
if (conn->file_fd == -1 && conn->fd >= 0) {
-#if IRCG_API_VERSION < 20021127
- conn->wbp = &conn->wb;
- irc_write_buf_add(conn->wbp, conn->fd);
-#else
- conn->wbp = IRCG_SHARED_ALLOC(sizeof(irc_write_buf));
- irc_write_buf_add_ex(conn->wbp, conn->fd, wbuf_destruct);
-#endif
-
- php_ircg->irc_set_currents++;
- IRCGG(flush_data) = conn;
+ if (irc_write_buf_add(&conn->wb, conn->fd) == 0) {
+ php_ircg->irc_set_currents++;
+ IRCGG(flush_data) = conn;
+ RETVAL_TRUE;
+ } else {
+ RETVAL_FALSE;
+ }
}
- RETVAL_TRUE;
}
put_irconn(conn);
}
@@ -2082,7 +2075,7 @@
#endif
msg_replay_buffer(conn);
- irc_write_buf_flush(conn->wbp);
+ irc_write_buf_flush(&conn->wb);
}
return SUCCESS;
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php