mirror of
git://git.gnu.org.ua/wordsplit.git
synced 2025-04-25 16:19:54 +03:00
Special handling for WRDSE_USAGE.
* src/wordsplit.c (wordsplit_run): Initialize ws_errctx early. This ensures that wordsplit_strerror gets correct data after WRDSE_USAGE. (wordsplit_free): Return immediately if errno was WRDSE_USAGE.
This commit is contained in:
parent
6c37c44ee0
commit
b4fefca052
1 changed files with 6 additions and 0 deletions
|
@ -2686,6 +2686,8 @@ wordsplit_run (const char *command, size_t length, struct wordsplit *wsp,
|
|||
int rc;
|
||||
size_t start;
|
||||
|
||||
/* Initialize error context early */
|
||||
wsp->ws_errctx = NULL;
|
||||
if (!command)
|
||||
{
|
||||
if (!(flags & WRDSF_INCREMENTAL))
|
||||
|
@ -2796,6 +2798,10 @@ wordsplit_clearerr (struct wordsplit *ws)
|
|||
void
|
||||
wordsplit_free (struct wordsplit *ws)
|
||||
{
|
||||
if (ws->ws_errno == WRDSE_USAGE)
|
||||
/* Usage error: the structure is not properly initialized and there's
|
||||
nothing to free. */
|
||||
return;
|
||||
wordsplit_clearerr (ws);
|
||||
wordsplit_free_nodes (ws);
|
||||
wordsplit_free_words (ws);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue