Whoops! Thanks. Apparently I only tested it on cases that either had content (non-whitespace) from the beginning of the string, or was an empty string (""). Silly. Patch here:


Also noted another thing that was bad (in such a small, simple function) after I wrote a unit test. Should do more of those. :)

Regards, Simon

On Sat, May 18, 2013 at 6:17 PM, Lars Windolf <lars.lindner@gmail.com> wrote:
Damn. Right!

Thanks for reviewing!

Best Regards,

On Sat, May 18, 2013 at 6:07 PM, Emilio Pozuelo Monfort <pochu27@gmail.com> wrote:
Hi Lars!

On 18/05/13 17:51, Lars Windolf wrote:
+common_str_is_empty (const gchar *s)
+       g_return_val_if_fail (s != NULL, TRUE);
+       while (*s != '\0') {
+               if (!g_ascii_isspace (*s))
+                       return FALSE;
+       }
+       return TRUE;

Can't this lead to an infinite loop? Looks to me like there should be an 's++;' inside the while loop.


AlienVault Unified Security Management (USM) platform delivers complete
security visibility with the essential security capabilities. Easily and
efficiently configure, manage, and operate all of your security controls
from a single console and one unified framework. Download a free trial.
Liferea-devel mailing list