chiark / gitweb /
extract_first_word: Refactor allocation in empty argument case
authorFilipe Brandenburger <filbranden@google.com>
Mon, 31 Aug 2015 02:16:50 +0000 (19:16 -0700)
committerSven Eden <yamakuzure@gmx.net>
Tue, 14 Mar 2017 09:19:06 +0000 (10:19 +0100)
commitd58deedf28351f217c1348604eab87ec075975c2
treee9d8d8801c9325b6c024e771c7b98b73d3414c14
parent8875ab3b75fb21bec36f56d08043ab50dfe650f8
extract_first_word: Refactor allocation in empty argument case

This covers the case where an argument is an empty string, such as ''.

Instead of allocating the empty string in the individual conditions when
state == VALUE, just always allocate it at the end of state == START, at
which point we know we will have an argument.

Tested that test-util keeps passing after the refactor.

Follow up to: 14e685c29d5b317b815e3e9f056648027852b07e
src/basic/util.c