[Xfce-i18n] WG: Re: Translation of "Application" and "Places" to German

Enrico Tröger enrico.troeger at uvena.de
Mon Aug 18 10:40:20 CEST 2008


On Mon, 18 Aug 2008 10:32:56 +0200, "Nick Schermer"
<nickschermer at gmail.com> wrote:

> 2008/8/18 Jean-François Wauthy <pollux at xfce.org>:
> > On Thu, 2008-08-14 at 14:33 +0300, Jari Rahkonen wrote:
> >
> >> +    if(value && value != "") {
> >
> > FYI, you're comparing pointers here.
> > strlen (value) > 0 would be better IMO.
> 
> Is strlen NULL safe then?
> 
> if (value && *value != '\0') is also a good way to check if the string
> is 'empty'.

Yeah, that's probably the best and most easy way and avoids any
problems with strlen() implementations which might crash on passed NULL
pointers (remember not everyone is using glibc).

In Geany, we have a little convenience macro for this:

#define NZV(ptr)    ((ptr) && (ptr)[0])

NZV means non-zero-value and can be used as simple as this:

> +    if(NZV(value)) {

maybe it's worth to add something similar to libxfce4util or so.

Regards,
Enrico

-- 
Get my GPG key from http://www.uvena.de/pub.asc
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: <http://mail.xfce.org/pipermail/xfce-i18n/attachments/20080818/a8ce377d/attachment.pgp>


More information about the Xfce-i18n mailing list