# HG changeset patch # User Michael Shkutkov # Date 1181949192 0 # Node ID b5e9a814b711c59f166c3d5c8d9fe5a85d1f6f41 # Parent c8d2e131cc370451e3d771ca736b822e47240834 using strstr instead of while diff -r c8d2e131cc37 -r b5e9a814b711 libpurple/plugins/log_reader.c --- a/libpurple/plugins/log_reader.c Wed Jun 13 12:26:17 2007 +0000 +++ b/libpurple/plugins/log_reader.c Fri Jun 15 23:13:12 2007 +0000 @@ -1766,9 +1766,6 @@ gsize length; gchar *c; - purple_debug(PURPLE_DEBUG_INFO, "QIP logger list", - "start\n"); - g_return_val_if_fail(sn != NULL, list); g_return_val_if_fail(account != NULL, list); @@ -1826,15 +1823,12 @@ purple_str_has_prefix(c, QIP_LOG_OUT_MESSAGE)) { /* find next line */ - while(*c && *c != '\n') { - c++; - } + c = strstr(c, "\n"); if (*c) { - char *timestamp = c; + char *timestamp = ++c; - while (*timestamp && (*timestamp !='(')) - timestamp++; + timestamp = strstr(timestamp, "("); if (*timestamp == '(') { struct tm tm; @@ -1963,15 +1957,14 @@ purple_debug(PURPLE_DEBUG_INFO, "QIP loggger read", "%s message\n", (is_in_message) ? "incoming" : "Outgoing"); - /* find next line */ - while(*c && *c!= '\n') - c++; + /* find EOL */ + c = strstr(c, "\n"); + /* XXX: Do we need buddy_name when we have buddy->alias? */ - buddy_name = c; + buddy_name = ++c; /* we hope that nickname hasn't '(' symbol */ - while (*c && *c != '(') - c++; + c = strstr(c, "("); if (*c == '(') { const char *timestamp = c; @@ -2010,9 +2003,8 @@ "%s: ", acct_name); } - /* find next line */ - while(c && *c != '\n') - c++; + /* find EOF */ + c = strstr(c, "\n"); line = ++c;