Mercurial > pidgin
comparison src/gtkimhtml.c @ 1519:d3ff7d80b8fb
[gaim-migrate @ 1529]
faster is_smiley check
committer: Tailor Script <tailor@pidgin.im>
| author | Eric Warmenhoven <eric@warmenhoven.org> |
|---|---|
| date | Tue, 27 Feb 2001 21:01:40 +0000 |
| parents | 206f995a33f3 |
| children | a5c87ada5143 |
comparison
equal
deleted
inserted
replaced
| 1518:e85a3a0e0975 | 1519:d3ff7d80b8fb |
|---|---|
| 184 | 184 |
| 185 gdk_cursor_destroy (imhtml->hand_cursor); | 185 gdk_cursor_destroy (imhtml->hand_cursor); |
| 186 gdk_cursor_destroy (imhtml->arrow_cursor); | 186 gdk_cursor_destroy (imhtml->arrow_cursor); |
| 187 | 187 |
| 188 g_hash_table_destroy (imhtml->smiley_hash); | 188 g_hash_table_destroy (imhtml->smiley_hash); |
| 189 if (imhtml->smiley_start) | |
| 190 g_string_free (imhtml->smiley_start, TRUE); | |
| 189 | 191 |
| 190 if (GTK_OBJECT_CLASS (parent_class)->destroy != NULL) | 192 if (GTK_OBJECT_CLASS (parent_class)->destroy != NULL) |
| 191 (* GTK_OBJECT_CLASS (parent_class)->destroy) (object); | 193 (* GTK_OBJECT_CLASS (parent_class)->destroy) (object); |
| 192 } | 194 } |
| 193 | 195 |
| 1478 imhtml->smin = strlen (text); | 1480 imhtml->smin = strlen (text); |
| 1479 | 1481 |
| 1480 if (strlen (text) > imhtml->smax) | 1482 if (strlen (text) > imhtml->smax) |
| 1481 imhtml->smax = strlen (text); | 1483 imhtml->smax = strlen (text); |
| 1482 | 1484 |
| 1485 if (!imhtml->smiley_start) | |
| 1486 imhtml->smiley_start = g_string_new (""); | |
| 1487 | |
| 1488 if (!strchr (imhtml->smiley_start->str, text [0])) | |
| 1489 imhtml->smiley_start = g_string_append_c (imhtml->smiley_start, text [0]); | |
| 1490 | |
| 1483 if (xpm == NULL) | 1491 if (xpm == NULL) |
| 1484 g_hash_table_remove (imhtml->smiley_hash, text); | 1492 g_hash_table_remove (imhtml->smiley_hash, text); |
| 1485 else | 1493 else |
| 1486 g_hash_table_insert (imhtml->smiley_hash, text, xpm); | 1494 g_hash_table_insert (imhtml->smiley_hash, text, xpm); |
| 1487 } | 1495 } |
| 1802 gint i; | 1810 gint i; |
| 1803 | 1811 |
| 1804 g_return_val_if_fail (imhtml != NULL, 0); | 1812 g_return_val_if_fail (imhtml != NULL, 0); |
| 1805 g_return_val_if_fail (GTK_IS_IMHTML (imhtml), 0); | 1813 g_return_val_if_fail (GTK_IS_IMHTML (imhtml), 0); |
| 1806 g_return_val_if_fail (text != NULL, 0); | 1814 g_return_val_if_fail (text != NULL, 0); |
| 1815 | |
| 1816 if (!imhtml->smiley_start || !strchr (imhtml->smiley_start->str, text [0])) | |
| 1817 return 0; | |
| 1807 | 1818 |
| 1808 tmp = g_malloc (imhtml->smax + 1); | 1819 tmp = g_malloc (imhtml->smax + 1); |
| 1809 | 1820 |
| 1810 for (i = imhtml->smin; i <= imhtml->smax; i++) { | 1821 for (i = imhtml->smin; i <= imhtml->smax; i++) { |
| 1811 if (strlen (text) < i) { | 1822 if (strlen (text) < i) { |
