guile-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] more descriptive error for dynamic-pointer


From: Andy Wingo
Subject: Re: [PATCH] more descriptive error for dynamic-pointer
Date: Thu, 31 Mar 2011 16:56:02 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux)

On Thu 31 Mar 2011 16:32, address@hidden (Ludovic Courtès) writes:

> Hello,
>
> Mike Gran <address@hidden> writes:
>
>> +      const char *lt_err = lt_dlerror ();
>> +      if (lt_err == (const char *) NULL || strncmp (lt_err, "No Error", 
>> strlen ("No Error")))
>> +    {
>> +      char *msg;
>> +      int ret;
>> +      ret = asprintf (&msg, "symbol \"%s\" not found", symb);
>> +      if (ret != -1)
>> +        {
>> +          scm_misc_error (subr, msg, SCM_EOL);
>> +          free (msg);
>> +        }
>> +      else
>> +        scm_misc_error (subr, "symbol not found", SCM_EOL);
>> +    }
>> +      else
>> +    scm_misc_error (subr, (char *) lt_dlerror (), SCM_EOL);
>
> Two things:
>
>   1. the bottom-most ‘scm_misc_error’ call should use ‘lt_err’.
>
>   2. ‘asprintf’ is a GNU extension so can’t be used here (unless we use
>      the right Gnulib module.)

There were more things: no need to asprintf, as you could just pass a
format string to scm_misc_error; and it's not actually an error to get
NULL from lt_dlsym, so you shouldn't call lt_dlerror there.

Andy
-- 
http://wingolog.org/



reply via email to

[Prev in Thread] Current Thread [Next in Thread]