libpurple/plugins/tcl/tcl_ref.c

changeset 16477
2fe930b4dcb6
parent 16433
2c3aa45bcd7c
child 16877
b2a8fef0a200
--- 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++;
 

mercurial