- suppose it's cleaner this way

Wed, 10 Dec 2014 19:25:41 +0200

author
Teemu Piippo <crimsondusk64@gmail.com>
date
Wed, 10 Dec 2014 19:25:41 +0200
changeset 3
592845e6f9e8
parent 2
8be472cb0bca
child 4
ec5387e121fa

- suppose it's cleaner this way

sources/version.cpp file | annotate | diff | comparison | revisions
--- a/sources/version.cpp	Wed Dec 10 19:22:51 2014 +0200
+++ b/sources/version.cpp	Wed Dec 10 19:25:41 2014 +0200
@@ -45,11 +45,10 @@
 
 	if (buffer[0] == '\0')
 	{
-		char* ptr = &buffer[0];
-		snprintf (ptr, sizeof buffer - (ptr - buffer), "%s-%s", version_string(), HG_NODE);
-
 		if (strcmp (HG_BRANCH, "default") != 0)
-			snprintf (ptr, sizeof buffer - (ptr - buffer), " (%s)", HG_BRANCH);
+			snprintf (buffer, "%s-%s (%s)", version_string(), HG_NODE, HG_BRANCH);
+		else
+			snprintf (buffer, "%s-%s", version_string(), HG_NODE);
 	}
 
 	return buffer;

mercurial