Remove obsolete strspn() call that causes valgrind warnings about invalid read().

The strspn() call was added in r8500 but the usage of its return value
was removed in r10315, so it isn't neccesary anyway.

The macro GNC_DEPRECATED is defined nowhere and used nowhere else, so
we can remove that block altogether.

git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@22071 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Christian Stimming 2012-03-08 22:47:59 +00:00
parent af0709b732
commit d90301b2bd

View File

@ -1381,27 +1381,17 @@ gnc_num_dbg_to_string(gnc_numeric n)
gboolean
string_to_gnc_numeric(const gchar* str, gnc_numeric *n)
{
size_t num_read;
gint64 tmpnum;
gint64 tmpdenom;
if (!str) return FALSE;
#ifdef GNC_DEPRECATED
/* must use "<" here because %n's effects aren't well defined */
if (sscanf(str, " " QOF_SCANF_LLD "/" QOF_SCANF_LLD "%n",
&tmpnum, &tmpdenom, &num_read) < 2)
{
return FALSE;
}
#else
tmpnum = g_ascii_strtoll (str, NULL, 0);
str = strchr (str, '/');
if (!str) return FALSE;
str ++;
tmpdenom = g_ascii_strtoll (str, NULL, 0);
num_read = strspn (str, "0123456789");
#endif
n->num = tmpnum;
n->denom = tmpdenom;
return TRUE;