Mercurial > pidgin.yaz
changeset 16432:f9597f375b07
merge of '0b7fa990cc064a8d716ba2a8700c6a8786b9f65e'
and '10a3b2875c4421cf84b22f91b68f0abf05368da1'
author | Luke Schierer <lschiere@pidgin.im> |
---|---|
date | Thu, 26 Apr 2007 00:45:29 +0000 |
parents | 8ae1ef832c55 (current diff) 728b4288c061 (diff) |
children | f8eb3e7c4fbd |
files | |
diffstat | 1 files changed, 6 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/libpurple/plugins/tcl/tcl_ref.c Thu Apr 26 00:26:44 2007 +0000 +++ b/libpurple/plugins/tcl/tcl_ref.c Thu Apr 26 00:45:29 2007 +0000 @@ -114,17 +114,18 @@ char *ptr; PurpleStringref *type; void *value; - int magicnumber = strlen("purple-"); + static const char const *prefix = "purple-"; + static const int prefixlen = sizeof(prefix) - 1; - if (strlen(bytes) < magicnumber - || strncmp(bytes, "purple-", magicnumber) + if (strlen(bytes) < prefixlen + || strncmp(bytes, prefix, prefixlen) || (ptr = strchr(bytes, ':')) == NULL - || (ptr - bytes) == magicnumber) + || (ptr - bytes) == prefixlen) goto badobject; /* Bad Ethan */ *ptr = '\0'; - type = purple_stringref_new(bytes + magicnumber); + type = purple_stringref_new(bytes + prefixlen); *ptr = ':'; ptr++;