Rename fmt_string -> sudo_new_key_val to better describe its function.
This commit is contained in:
@@ -96,7 +96,7 @@ DEVEL = @DEVEL@
|
||||
SHELL = @SHELL@
|
||||
|
||||
LTOBJS = alloc.lo atobool.lo atoid.lo atomode.lo event.lo fatal.lo fileops.lo \
|
||||
fmt_string.lo gidlist.lo lbuf.lo progname.lo secure_path.lo \
|
||||
key_val.lo gidlist.lo lbuf.lo progname.lo secure_path.lo \
|
||||
setgroups.lo sudo_conf.lo sudo_debug.lo sudo_dso.lo sudo_printf.lo \
|
||||
term.lo ttysize.lo @COMMON_OBJS@ @LTLIBOBJS@
|
||||
|
||||
@@ -334,14 +334,9 @@ fatal.lo: $(srcdir)/fatal.c $(incdir)/alloc.h $(incdir)/compat/stdbool.h \
|
||||
$(incdir)/fatal.h $(incdir)/gettext.h $(incdir)/missing.h \
|
||||
$(incdir)/queue.h $(incdir)/sudo_plugin.h $(top_builddir)/config.h
|
||||
$(LIBTOOL) --mode=compile $(CC) -c -o $@ $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(srcdir)/fatal.c
|
||||
fileops.lo: $(srcdir)/fileops.c $(incdir)/compat/stdbool.h \
|
||||
$(incdir)/compat/timespec.h $(incdir)/fileops.h \
|
||||
fileops.lo: $(srcdir)/fileops.c $(incdir)/compat/stdbool.h $(incdir)/fileops.h \
|
||||
$(incdir)/missing.h $(incdir)/sudo_debug.h $(top_builddir)/config.h
|
||||
$(LIBTOOL) --mode=compile $(CC) -c -o $@ $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(srcdir)/fileops.c
|
||||
fmt_string.lo: $(srcdir)/fmt_string.c $(incdir)/compat/stdbool.h \
|
||||
$(incdir)/missing.h $(incdir)/sudo_debug.h \
|
||||
$(incdir)/sudo_util.h $(top_builddir)/config.h
|
||||
$(LIBTOOL) --mode=compile $(CC) -c -o $@ $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(srcdir)/fmt_string.c
|
||||
fnm_test.lo: $(srcdir)/regress/fnmatch/fnm_test.c $(incdir)/compat/fnmatch.h \
|
||||
$(incdir)/missing.h $(top_builddir)/config.h
|
||||
$(LIBTOOL) --mode=compile $(CC) -c -o $@ $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(srcdir)/regress/fnmatch/fnm_test.c
|
||||
@@ -382,6 +377,10 @@ hltq_test.lo: $(srcdir)/regress/tailq/hltq_test.c $(incdir)/compat/stdbool.h \
|
||||
$(LIBTOOL) --mode=compile $(CC) -c -o $@ $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(srcdir)/regress/tailq/hltq_test.c
|
||||
isblank.lo: $(srcdir)/isblank.c $(incdir)/missing.h $(top_builddir)/config.h
|
||||
$(LIBTOOL) --mode=compile $(CC) -c -o $@ $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(srcdir)/isblank.c
|
||||
key_val.lo: $(srcdir)/key_val.c $(incdir)/compat/stdbool.h $(incdir)/missing.h \
|
||||
$(incdir)/sudo_debug.h $(incdir)/sudo_util.h \
|
||||
$(top_builddir)/config.h
|
||||
$(LIBTOOL) --mode=compile $(CC) -c -o $@ $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(srcdir)/key_val.c
|
||||
lbuf.lo: $(srcdir)/lbuf.c $(incdir)/alloc.h $(incdir)/fatal.h $(incdir)/lbuf.h \
|
||||
$(incdir)/missing.h $(incdir)/sudo_debug.h $(top_builddir)/config.h
|
||||
$(LIBTOOL) --mode=compile $(CC) -c -o $@ $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(srcdir)/lbuf.c
|
||||
|
@@ -42,20 +42,21 @@
|
||||
#include "sudo_util.h"
|
||||
|
||||
/*
|
||||
* Allocate storage for a name=value string and return it.
|
||||
* Create a new key=value pair and return it.
|
||||
* The caller is responsible for freeing the string.
|
||||
*/
|
||||
char *
|
||||
fmt_string(const char *var, const char *val)
|
||||
sudo_new_key_val(const char *key, const char *val)
|
||||
{
|
||||
size_t var_len = strlen(var);
|
||||
size_t key_len = strlen(key);
|
||||
size_t val_len = strlen(val);
|
||||
char *cp, *str;
|
||||
debug_decl(fmt_string, SUDO_DEBUG_UTIL)
|
||||
debug_decl(sudo_new_key_val, SUDO_DEBUG_UTIL)
|
||||
|
||||
cp = str = malloc(var_len + 1 + val_len + 1);
|
||||
if (str != NULL) {
|
||||
memcpy(cp, var, var_len);
|
||||
cp += var_len;
|
||||
cp = str = malloc(key_len + 1 + val_len + 1);
|
||||
if (str != NULL) {
|
||||
memcpy(cp, key, key_len);
|
||||
cp += key_len;
|
||||
*cp++ = '=';
|
||||
memcpy(cp, val, val_len);
|
||||
cp += val_len;
|
@@ -40,7 +40,6 @@ fatal_callback_deregister
|
||||
fatal_callback_register
|
||||
fatal_nodebug
|
||||
fatalx_nodebug
|
||||
fmt_string
|
||||
get_ttysize
|
||||
getprogname
|
||||
initprogname
|
||||
@@ -120,6 +119,7 @@ sudo_memrchr
|
||||
sudo_memset_s
|
||||
sudo_mkdtemp
|
||||
sudo_mkstemps
|
||||
sudo_new_key_val
|
||||
sudo_parseln
|
||||
sudo_printf
|
||||
sudo_pw_dup
|
||||
|
Reference in New Issue
Block a user