mirror of
https://github.com/openvswitch/ovs
synced 2025-08-31 06:15:47 +00:00
util: New function nullable_xstrdup().
It's a pretty common pattern so create a function for it. Signed-off-by: Ben Pfaff <blp@ovn.org>
This commit is contained in:
@@ -2531,7 +2531,7 @@ dpif_netdev_pmd_set(struct dpif *dpif, const char *cmask)
|
||||
|
||||
if (!cmask_equals(dp->requested_pmd_cmask, cmask)) {
|
||||
free(dp->requested_pmd_cmask);
|
||||
dp->requested_pmd_cmask = cmask ? xstrdup(cmask) : NULL;
|
||||
dp->requested_pmd_cmask = nullable_xstrdup(cmask);
|
||||
}
|
||||
|
||||
return 0;
|
||||
@@ -2690,9 +2690,7 @@ reconfigure_pmd_threads(struct dp_netdev *dp)
|
||||
/* Reconfigures the cpu mask. */
|
||||
ovs_numa_set_cpu_mask(dp->requested_pmd_cmask);
|
||||
free(dp->pmd_cmask);
|
||||
dp->pmd_cmask = dp->requested_pmd_cmask
|
||||
? xstrdup(dp->requested_pmd_cmask)
|
||||
: NULL;
|
||||
dp->pmd_cmask = nullable_xstrdup(dp->requested_pmd_cmask);
|
||||
|
||||
/* Restores the non-pmd. */
|
||||
dp_netdev_set_nonpmd(dp);
|
||||
|
Reference in New Issue
Block a user