# HG changeset patch # User Ethan Blanton # Date 1177544179 0 # Node ID 728b4288c0619bcf7e76901fb3d8688456621ff7 # Parent 50380e48fb65639e1acbfbaa1059351300a5575e The compiler is really smart enough to catch this, but let's make it explicit. diff -r 50380e48fb65 -r 728b4288c061 libpurple/plugins/tcl/tcl_ref.c --- a/libpurple/plugins/tcl/tcl_ref.c Wed Apr 25 21:49:37 2007 +0000 +++ b/libpurple/plugins/tcl/tcl_ref.c Wed Apr 25 23:36:19 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++;