sas             Fri Jan 12 05:49:16 2001 EDT

  Modified files:              
    /php4/ext/ircg      ircg.c 
  Log:
  Make some strings static to avoid reallocating the buffers a thousand
  times per second.
  
  
Index: php4/ext/ircg/ircg.c
diff -u php4/ext/ircg/ircg.c:1.15 php4/ext/ircg/ircg.c:1.16
--- php4/ext/ircg/ircg.c:1.15   Fri Jan 12 05:35:30 2001
+++ php4/ext/ircg/ircg.c        Fri Jan 12 05:49:16 2001
@@ -342,8 +342,9 @@
                smart_str *msg, void *conn_data, void *chan_data)
 {
        php_irconn_t *conn = conn_data;
-       smart_str m = {0};
+       static smart_str m;
 
+       m.len = 0;      
        if (chan) {
                format_msg(MSG(conn, FMT_MSG_CHAN), chan, ircc->username, from, msg->c,
                                &m);
@@ -353,19 +354,18 @@
        }
 
        msg_send(conn, &m);
-       smart_str_free_ex(&m, 1);
 }
 
 static void error_handler(irconn_t *ircc, int id, int fatal, smart_str *msg, void 
*conn_data)
 {
        php_irconn_t *conn = conn_data;
-       smart_str m = {0};
+       static smart_str m;
 
+       m.len = 0;      
        format_msg(MSG(conn, fatal ? FMT_MSG_FATAL_ERROR : FMT_MSG_ERROR), NULL, 
                        ircc->username, "IRC SERVER", msg->c, &m);
        
        msg_send(conn, &m);
-       smart_str_free_ex(&m, 1);
 }
 
 static void user_add(irconn_t *ircc, const char *channel, smart_str *users,
@@ -373,7 +373,7 @@
 {
        php_irconn_t *conn = dummy;
        int i;
-       smart_str m = {0};
+       static smart_str m;
 
        for (i = 0; i < nr; i++) {
                m.len = 0;
@@ -381,7 +381,6 @@
                                "", &m);
                msg_send(conn, &m);
        }
-       smart_str_free_ex(&m, 1);
 }
 
 static void new_topic(irconn_t *ircc, const char *channel, smart_str *who, smart_str 
*topic, void *dummy)



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to