summaryrefslogtreecommitdiffstats
path: root/libmount/src/tab.c
diff options
context:
space:
mode:
Diffstat (limited to 'libmount/src/tab.c')
-rw-r--r--libmount/src/tab.c26
1 files changed, 2 insertions, 24 deletions
diff --git a/libmount/src/tab.c b/libmount/src/tab.c
index a8d835e04..b09c79f0d 100644
--- a/libmount/src/tab.c
+++ b/libmount/src/tab.c
@@ -287,18 +287,7 @@ const char *mnt_table_get_intro_comment(struct libmnt_table *tb)
*/
int mnt_table_set_intro_comment(struct libmnt_table *tb, const char *comm)
{
- char *p = NULL;
-
- if (!tb)
- return -EINVAL;
- if (comm) {
- p = strdup(comm);
- if (!p)
- return -ENOMEM;
- }
- free(tb->comm_intro);
- tb->comm_intro = p;
- return 0;
+ return strdup_to_struct_member(tb, comm_intro, comm);
}
/**
@@ -339,18 +328,7 @@ const char *mnt_table_get_trailing_comment(struct libmnt_table *tb)
*/
int mnt_table_set_trailing_comment(struct libmnt_table *tb, const char *comm)
{
- char *p = NULL;
-
- if (!tb)
- return -EINVAL;
- if (comm) {
- p = strdup(comm);
- if (!p)
- return -ENOMEM;
- }
- free(tb->comm_tail);
- tb->comm_tail = p;
- return 0;
+ return strdup_to_struct_member(tb, comm_tail, comm);
}
/**