Mercurial > pidgin
annotate src/protocols/simple/simple.h @ 12229:18f0dadb29cf
[gaim-migrate @ 14531]
SF Patch #1366481 from Michael Carlson
"The function gtk_smiley_tree_insert() in gtkimhtml.c is
using up (on my system) the most CPU of all the
functions in gaim whenever the preferences box is
opened (tested by opening the preferences box 50 times
and measuring with oprofile).
The function is called some 297 times each time the
prefs box is opened, and each time we call strlen() on
a (usually 3 or 4) character string to see if the
string is empty or not.
I've eliminated the unnecessary call to strlen by
checking the first element, and I've changed the while
{} loop to a do {} while loop, because since we return
if the string is empty at the beginning of the
function, the same check on the first iteration of the
loop is unnecessary.
I believe it's faster for every case, even if only by a
little bit."
I don't know how necessary this is, but it doesn't hurt and it doesn't negatively impact the readability of the code.
I also fixed an existing piece of code for which the compiler issued a warning.
committer: Tailor Script <tailor@pidgin.im>
| author | Richard Laager <rlaager@wiktel.com> |
|---|---|
| date | Sat, 26 Nov 2005 17:09:29 +0000 |
| parents | 2f379ed0c26b |
| children | cfc808463763 |
| rev | line source |
|---|---|
| 11181 | 1 /** |
| 2 * @file simple.h | |
| 3 * | |
| 4 * gaim | |
| 5 * | |
| 6 * Copyright (C) 2005, Thomas Butter <butter@uni-mannheim.de> | |
| 7 * | |
| 8 * This program is free software; you can redistribute it and/or modify | |
| 9 * it under the terms of the GNU General Public License as published by | |
| 10 * the Free Software Foundation; either version 2 of the License, or | |
| 11 * (at your option) any later version. | |
| 12 * | |
| 13 * This program is distributed in the hope that it will be useful, | |
| 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 16 * GNU General Public License for more details. | |
| 17 * | |
| 18 * You should have received a copy of the GNU General Public License | |
| 19 * along with this program; if not, write to the Free Software | |
| 20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
| 21 */ | |
| 22 | |
| 23 #ifndef _GAIM_SIMPLE_H | |
| 24 #define _GAIM_SIMPLE_H | |
| 25 | |
| 26 #include <glib.h> | |
| 27 #include <time.h> | |
| 28 #include <prpl.h> | |
| 29 #include <digcalc.h> | |
| 30 #include "sipmsg.h" | |
| 31 | |
| 32 #define SIMPLE_BUF_INC 1024 | |
| 33 | |
| 34 struct sip_dialog { | |
| 35 gchar *ourtag; | |
| 36 gchar *theirtag; | |
| 37 gchar *callid; | |
| 38 }; | |
| 39 | |
| 40 struct simple_watcher { | |
| 41 gchar *name; | |
| 42 time_t expire; | |
| 43 struct sip_dialog dialog; | |
| 44 }; | |
| 45 | |
| 46 struct simple_buddy { | |
| 47 gchar *name; | |
| 48 time_t resubscribe; | |
| 49 }; | |
| 50 | |
| 51 struct sip_auth { | |
| 11346 | 52 int type; /* 1 = Digest / 2 = NTLM */ |
| 11181 | 53 gchar *nonce; |
| 54 gchar *realm; | |
| 11424 | 55 gchar *target; |
| 11181 | 56 int nc; |
| 57 HASHHEX HA1; | |
| 11346 | 58 int retries; |
| 11181 | 59 }; |
| 60 | |
| 61 struct simple_account_data { | |
| 62 GaimConnection *gc; | |
| 63 gchar *servername; | |
| 64 gchar *username; | |
| 65 gchar *password; | |
| 66 int fd; | |
| 67 int cseq; | |
| 68 time_t reregister; | |
| 69 time_t republish; | |
|
11829
4669e7461968
[gaim-migrate @ 14120]
Richard Laager <rlaager@wiktel.com>
parents:
11424
diff
changeset
|
70 int registerstatus; /* 0 nothing, 1 first registration send, 2 auth received, 3 registered */ |
| 11181 | 71 struct sip_auth registrar; |
| 72 struct sip_auth proxy; | |
| 73 int listenfd; | |
| 74 int listenport; | |
| 11409 | 75 int listenpa; |
| 11181 | 76 gchar *ip; |
| 77 gchar *status; | |
| 78 GHashTable *buddies; | |
| 79 guint registertimeout; | |
| 11194 | 80 guint resendtimeout; |
| 11181 | 81 int connecting; |
| 82 GaimAccount *account; | |
| 83 gchar *sendlater; | |
| 12196 | 84 gchar *regcallid; |
| 11181 | 85 GSList *transactions; |
| 86 GSList *watcher; | |
| 87 GSList *openconns; | |
| 11189 | 88 gboolean udp; |
| 89 struct sockaddr_in serveraddr; | |
| 11194 | 90 int registerexpire; |
| 11383 | 91 gchar *realhostname; |
| 92 int realport; /* port and hostname from SRV record */ | |
| 11181 | 93 }; |
| 94 | |
| 95 struct sip_connection { | |
| 96 int fd; | |
| 97 gchar *inbuf; | |
| 98 int inbuflen; | |
| 99 int inbufused; | |
| 100 int inputhandler; | |
| 101 }; | |
| 102 | |
| 103 struct transaction; | |
| 104 | |
| 105 typedef gboolean (*TransCallback) (struct simple_account_data *, struct sipmsg *, struct transaction *); | |
| 106 | |
| 107 struct transaction { | |
| 108 time_t time; | |
| 109 int retries; | |
|
11829
4669e7461968
[gaim-migrate @ 14120]
Richard Laager <rlaager@wiktel.com>
parents:
11424
diff
changeset
|
110 int transport; /* 0 = tcp, 1 = udp */ |
| 11181 | 111 int fd; |
| 112 gchar *cseq; | |
| 113 struct sipmsg *msg; | |
| 114 TransCallback callback; | |
| 115 }; | |
| 116 | |
| 117 #endif /* _GAIM_SIMPLE_H */ |
