changeset 16337:2cf8383a806f

<elb> nosnilmot: those magic numbers should probably have been fixed to not be so magic ;-) This should help us for the next time we need to rename.
author Stu Tomlinson <stu@nosnilmot.com>
date Tue, 24 Apr 2007 02:51:53 +0000
parents d3d18abf5df5
children 2a575756340a
files libpurple/plugins/tcl/tcl_ref.c
diffstat 1 files changed, 5 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/plugins/tcl/tcl_ref.c	Tue Apr 24 01:44:49 2007 +0000
+++ b/libpurple/plugins/tcl/tcl_ref.c	Tue Apr 24 02:51:53 2007 +0000
@@ -114,16 +114,17 @@
 	char *ptr;
 	PurpleStringref *type;
 	void *value;
+	int magicnumber = strlen("purple-");
 
-	if (strlen(bytes) < 7
-	    || strncmp(bytes, "purple-", 7)
+	if (strlen(bytes) < magicnumber
+	    || strncmp(bytes, "purple-", magicnumber)
 	    || (ptr = strchr(bytes, ':')) == NULL
-	    || (ptr - bytes) == 7)
+	    || (ptr - bytes) == magicnumber)
 		goto badobject;
 
 	/* Bad Ethan */
 	*ptr = '\0';
-	type = purple_stringref_new(bytes + 7);
+	type = purple_stringref_new(bytes + magicnumber);
 	*ptr = ':';
 	ptr++;