[PATCH 04/10] remote_driver: Expose EXTRACT_URI_ARG_* macros

Michal Prívozník mprivozn at redhat.com
Tue Feb 7 16:43:50 UTC 2023


On 2/7/23 09:05, Peter Krempa wrote:
> On Mon, Feb 06, 2023 at 10:16:52 +0100, Michal Privoznik wrote:
>> Almost in all places where an URI is parsed we look for
>> additional argument(s). The remote driver's parsing uses two
>> macros EXTRACT_URI_ARG_STR() and EXTRACT_URI_ARG_BOOL() for that
>> purpose. Expose these so that other places can be rewritten using
>> those macros.
>>
>> Signed-off-by: Michal Privoznik <mprivozn at redhat.com>
>> ---
>>  po/POTFILES                |  1 +
>>  src/remote/remote_driver.c | 58 +++++++++++---------------------------
>>  src/util/viruri.h          | 23 +++++++++++++++
>>  3 files changed, 40 insertions(+), 42 deletions(-)
> 
> [...]
> 
>> diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c
>> index 6a226999df..c41d5b414f 100644
>> --- a/src/remote/remote_driver.c
>> +++ b/src/remote/remote_driver.c
>> @@ -693,30 +693,6 @@ remoteConnectSupportsFeatureUnlocked(virConnectPtr conn,
>>      return rc != -1 && ret.supported;
>>  }
>>  
>> -/* helper macro to ease extraction of arguments from the URI */
>> -#define EXTRACT_URI_ARG_STR(ARG_NAME, ARG_VAR) \
>> -    if (STRCASEEQ(var->name, ARG_NAME)) { \
>> -        VIR_FREE(ARG_VAR); \
>> -        ARG_VAR = g_strdup(var->value); \
>> -        var->ignore = 1; \
>> -        continue; \
>> -    }
> 
> This style of macros, which apart from arguments also accesses variables
> directly from the place where it's expanded or influence control flow
> ...
> 
> 

Fair enough. I can do without this patch though. So let me just drop it
from v2.

Michal



More information about the libvir-list mailing list