Mercurial > libjeffpc
changeset 821:cbde4a6170af
nvl: use VT_NULL instead of NULL when setting a value
Pretty much all the consumers of nvlists assume that a name maps to a
non-NULL value pointer. This change silently converts NULL values to
VT_NULL values when being set.
Signed-off-by: Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
author | Josef 'Jeff' Sipek <jeffpc@josefsipek.net> |
---|---|
date | Fri, 30 Oct 2020 17:51:11 -0400 |
parents | fcbf39e8ae4e |
children | f8d9ccf26563 |
files | nvl.c |
diffstat | 1 files changed, 2 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/nvl.c Mon Oct 12 11:46:59 2020 -0400 +++ b/nvl.c Fri Oct 30 17:51:11 2020 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2018 Josef 'Jeff' Sipek <jeffpc@josefsipek.net> + * Copyright (c) 2017-2020 Josef 'Jeff' Sipek <jeffpc@josefsipek.net> * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -139,7 +139,7 @@ } val_putref(pair->value); - pair->value = val; + pair->value = val ? val : val_alloc_null(); return 0; }