On Sun, 15 Apr 2012 at 23:09:39 +0200, Rodolfo García Peñas wrote:
> The new StrConcatDot function can be used now in wdefaults.c
> ---
>  src/wdefaults.c |   15 +++++----------
>  1 files changed, 5 insertions(+), 10 deletions(-)
> 
> diff --git a/src/wdefaults.c b/src/wdefaults.c
> index c22ad5b..d680cf2 100644
> --- a/src/wdefaults.c
> +++ b/src/wdefaults.c
> @@ -1,3 +1,4 @@
> +
>  /* wdefaults.c - window specific defaults
>   *
>   *  Window Maker window manager
> @@ -181,8 +182,7 @@ wDefaultFillAttributes(WScreen * scr, char *instance, 
> char *class,
>       if (class && instance) {
>               char *buffer;
>  
> -             buffer = wmalloc(strlen(class) + strlen(instance) + 2);
> -             sprintf(buffer, "%s.%s", instance, class);
> +             buffer = StrConcatDot(instance, class, True);
>               key1 = WMCreatePLString(buffer);
>               wfree(buffer);
>       } else {
> @@ -472,6 +472,7 @@ void wDefaultChangeIcon(WScreen * scr, char *instance, 
> char *class, char *file)
>       WDDomain *db = WDWindowAttributes;
>       WMPropList *icon_value = NULL, *value, *attr, *key, *def_win, *def_icon 
> = NULL;
>       WMPropList *dict = db->dictionary;
> +     char *buffer = NULL;
>       int same = 0;
>  
>       if (!dict) {
> @@ -484,16 +485,10 @@ void wDefaultChangeIcon(WScreen * scr, char *instance, 
> char *class, char *file)
>  
>       WMPLSetCaseSensitive(True);
>  
> -     if (instance && class) {
> -             char *buffer;
> -             buffer = wmalloc(strlen(instance) + strlen(class) + 2);
> -             sprintf(buffer, "%s.%s", instance, class);
> +     if (instance || class) {
> +             buffer = StrConcatDot(instance, class, False);

Why didn't you keep the original && instead of changing it to || and 
using False?

I didn't like this extra parameter in StrConcatDot(). The name of the
function suggests that a dot will be added, making it depend on
the extra parameter confuses things, imho.

I think it is better to have StrConcatDot() always add the dot, because
that's what the name suggests.


-- 
To unsubscribe, send mail to [email protected].

Reply via email to