[Goodies-commits] r5680 - xfbib/branches/gobject/src

Jesper Karlsson zarper at xfce.org
Sat Oct 18 20:05:53 CEST 2008


Author: zarper
Date: 2008-10-18 18:05:53 +0000 (Sat, 18 Oct 2008)
New Revision: 5680

Modified:
   xfbib/branches/gobject/src/xfbib-bibtex-entry.c
Log:
Code cleanup.


Modified: xfbib/branches/gobject/src/xfbib-bibtex-entry.c
===================================================================
--- xfbib/branches/gobject/src/xfbib-bibtex-entry.c	2008-10-18 17:43:59 UTC (rev 5679)
+++ xfbib/branches/gobject/src/xfbib-bibtex-entry.c	2008-10-18 18:05:53 UTC (rev 5680)
@@ -87,21 +87,22 @@
 	gchar *tmp;
 	GString *buf;
 	XfbibBibtexField *field;
-	gint i, brackets, quotes;
+	gint i, brackets, quotes, len;
 
 	DBG("str = %s", str);
 
 	buf = g_string_new("");
 
+	len = strlen(str) - 1;
 	/* Dont copy the last bracket */
-	tmp = g_strndup(str, strlen(str) - 1);
+	tmp = g_strndup(str, len);
 
 	/* Parse entry type */
-	for (i = 0; i < strlen(tmp) && tmp[i] != '{' && tmp[i] != '('; i++)
+	for (i = 0; i < len && tmp[i] != '{' && tmp[i] != '('; i++)
 		buf = g_string_append_c(buf, tmp[i]);
 	entry->bibtype = g_strdup(buf->str);
 
-	if (i == strlen(tmp)) {
+	if (i == len) {
 		return FALSE;
 	}
 
@@ -113,7 +114,7 @@
 
 	buf = g_string_erase(buf, 0, -1);
 
-	for (i++, brackets = 0, quotes = 0; i < strlen(tmp); i++) {
+	for (i++, brackets = 0, quotes = 0; i < len; i++) {
 		if (tmp[i] == ',' && brackets == 0 && quotes%2 == 0) {
 			field = xfbib_bibtex_field_new();
 			if (!xfbib_bibtex_field_parse(field, buf->str))




More information about the Goodies-commits mailing list