Search the web
Sign In
New User? Sign Up
ClearSilver

Group Information

  • Members: 250
  • Category: Open Source
  • Founded: Jul 2, 2001
  • Language: English
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Hear how Yahoo! Groups has changed the lives of others. Take me there.

Messages

  Messages Help
Advanced
Does nerr_log_error free the NEO_ERR *   Message List  
Reply Message #1424 of 1429 |
Hi

Sorry to bother. According to the description and code example, the API  nerr_log_error should free the err chain. But I didn't find the respective code to release the err chain inside the implementation:

void nerr_log_error (NEOERR *err)
{
  NEOERR *more;
  char buf[1024];
  char *err_name;

  if (err == STATUS_OK)
    return;

  if (err == INTERNAL_ERR)
  {
    ne_warn ("Internal error");
    return;
  }

  more = err;
  fprintf (stderr, "Traceback (innermost last):\n");
  while (more && more != INTERNAL_ERR)
  {
    err = more;
    more = err->next;
    if (err->error != NERR_PASS)
    {
      NEOERR *r;
      if (err->error == 0)
      {
err_name = buf;
snprintf (buf, sizeof (buf), "Unknown Error");
      }
      else
      {
r = uListGet (Errors, err->error - 1, (void *)&err_name);
if (r != STATUS_OK)
{
  err_name = buf;
  snprintf (buf, sizeof (buf), "Error %d", err->error);
}
      }

      fprintf (stderr, "  File \"%s\", line %d, in %s()\n%s: %s\n", err->file
  err->lineno, err->func, err_name, err->desc);
    }
    else
    {
      fprintf (stderr, "  File \"%s\", line %d, in %s()\n", err->file
  err->lineno, err->func);
      if (err->desc[0])
      {
fprintf (stderr, "    %s\n", err->desc);
      }
    }
  }
}

So, is the err chain freed in other place or I have missed something inside the function? Does nerr_log_error free the err chain, as for nerr_err_string and nerr_err_traceback?

Thanks.

B.R.


Wed Dec 21, 2011 6:28 am

caox@...
Send Email Send Email

Message #1424 of 1429 |
Expand Messages Author Sort by Date

Hi Sorry to bother. According to the description and code example, the API nerr_log_error should free the err chain. But I didn't find the respective code to...
caox
caox@... Send Email
Dec 21, 2011
6:28 am

I don't think any of those free the error chain, where did you get that impression? Its not in the api docs, as near as I can tell. Brandon...
Brandon Long
blong42 Online Now Send Email
Dec 21, 2011
7:18 pm

hmm... I found it in the header file "neo_err.h": /* function: nerr_log_error * description: currently, this prints out the error to stderr, and *...
caox
caox@... Send Email
Dec 22, 2011
2:39 am

... Ah, the comment was fixed: http://code.google.com/p/clearsilver/source/detail?spec=svn861&r=861 ... It doesn't, just sloppy I guess. Brandon ... On Wed,...
Brandon Long
blong42 Online Now Send Email
Dec 22, 2011
7:33 am

OK, I see. That means we need call nerr_ignore after nerr_log_error if we want the err chain to be freed correctly. Thanks. ... OK, I see. That means we need...
caox
caox@... Send Email
Dec 22, 2011
7:48 am
Advanced

Copyright © 2010 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines NEW - Help