From: Ben Pfaff Date: Sun, 28 Aug 2022 21:18:48 +0000 (-0700) Subject: message: New function msg_location_merged(). X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?p=pspp;a=commitdiff_plain;h=82bc253ccb9a3fdcf1c6f3dd0bdcf1f2f71f7c40 message: New function msg_location_merged(). --- diff --git a/src/libpspp/message.c b/src/libpspp/message.c index 83c7320168..38726d9f5b 100644 --- a/src/libpspp/message.c +++ b/src/libpspp/message.c @@ -174,6 +174,16 @@ msg_location_merge (struct msg_location **dstp, const struct msg_location *src) dst->end = src->end; } +struct msg_location * +msg_location_merged (const struct msg_location *a, + const struct msg_location *b) +{ + struct msg_location *new = msg_location_dup (a); + if (b) + msg_location_merge (&new, b); + return new; +} + struct msg_location * msg_location_dup (const struct msg_location *src) { diff --git a/src/libpspp/message.h b/src/libpspp/message.h index 813febe82a..11e5b9d98e 100644 --- a/src/libpspp/message.h +++ b/src/libpspp/message.h @@ -118,6 +118,8 @@ struct msg_location *msg_location_dup (const struct msg_location *); void msg_location_remove_columns (struct msg_location *); void msg_location_merge (struct msg_location **, const struct msg_location *); +struct msg_location *msg_location_merged (const struct msg_location *, + const struct msg_location *); bool msg_location_is_empty (const struct msg_location *); void msg_location_format (const struct msg_location *, struct string *);