reverted commits

Ralf Habacker ralf.habacker at freenet.de
Thu Jul 12 04:45:15 PDT 2007


Havoc Pennington schrieb:
> Hi,
>
> Ralf Habacker wrote:
>> double dbus_strtod(const char *nptr, char **endptr)
>> {
>>     if (nptr && strlen(nptr) == 4 && nptr[0] == '0' && nptr[1] == 'x' &&
>> nptr[2] == 'f' && nptr[3] == 'f')
>>       {
>>         if (endptr)
>>           *endptr = nptr+4;
>>         return 0.0;
>>       }
>>     return strtod(nptr,endptr);
>> }
>>
>> There are still some issues. This function will be used in libdbus and
>> dbus-send. Therefore it must be a public dbus function or how to
>> proceed ?
>>
>
> Are you serious? 
yes
> You need to think about this patch some more.
Really ? I can't believe that you haven't seen that
_dbus_string_parse_double isn't used in any production code because it
is wrapped with DBUS_BUILD_TESTS.
The following patch removes the test. I would apply it if there are no
more objectitivies.

Ralf


Index: dbus/dbus-sysdeps-util.c
===================================================================
RCS file: /cvs/dbus/dbus/dbus/dbus-sysdeps-util.c,v
retrieving revision 1.12
diff -u -r1.12 dbus-sysdeps-util.c
--- dbus/dbus-sysdeps-util.c    21 Jun 2007 21:28:59 -0000    1.12
+++ dbus/dbus-sysdeps-util.c    12 Jul 2007 11:35:55 -0000
@@ -141,24 +141,6 @@
       exit (1);
     }
 
-  _dbus_string_init_const (&str, "0xff");
-  if (!_dbus_string_parse_double (&str,
-                  0, &val, &pos))
-    {
-      _dbus_warn ("Failed to parse double");
-      exit (1);
-    }
-  if (ABS (0xff - val) > 1e-6)
-    {
-      _dbus_warn ("Failed to parse 0xff correctly, got: %f\n", val);
-      exit (1);
-    }
-  if (pos != 4)
-    {
-      _dbus_warn ("_dbus_string_parse_double of \"0xff\" returned wrong
position %d", pos);
-      exit (1);
-    }
-
 #ifdef DBUS_WIN
   check_path_absolute ("c:/", TRUE);
   check_path_absolute ("c:/foo", TRUE);


Ralf


More information about the dbus mailing list