Use strdup to copy strings
authorSimon Wilkinson <sxw@your-file-system.com>
Wed, 16 May 2012 05:44:30 +0000 (06:44 +0100)
committerDerrick Brashear <shadow@dementix.org>
Thu, 24 May 2012 15:48:22 +0000 (08:48 -0700)
commitbd1248ca3988edb230174ff34c3ff79bedcf559e
treed3486cc6c0b0042cacc371f4f794ae624276aeb1
parent47e12584804b287051552900c94c99a3c84daa92
Use strdup to copy strings

Where we have
    newStr = malloc(strlen(oldStr)+1);
    strcpy(newStr, oldStr);

replace these with
    newStr = strdup(oldStr);

It's shorter, clearer, and gets rid of a load of occurences of strcpy,
which some compilers are now warning is unsafe (although it isn't in
this context)

Get rid of a number of custom duplicate string functions and replace
them with strdup where the behaviour is identical

Change-Id: If800343a7d13b1ba6362d4570a2a324fa3525250
Reviewed-on: http://gerrit.openafs.org/7450
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
48 files changed:
src/afsweb/apache_afs_plugin.c
src/bozo/bnode.c
src/bozo/bosoprocs.c
src/bozo/bosprototypes.h
src/bozo/cronbnodeops.c
src/bozo/fsbnodeops.c
src/bucoord/commands.c
src/bucoord/config.c
src/bucoord/dsvs.c
src/bucoord/dump_sched.c
src/bucoord/restore.c
src/bucoord/tape_hosts.c
src/bucoord/vol_sets.c
src/budb/server.c
src/butc/tcmain.c
src/butc/tcprocs.c
src/cmd/cmd.c
src/comerr/error_table.y
src/comerr/error_table_nt.c
src/comerr/et_lex.lex.l
src/comerr/et_lex.lex_nt.c
src/config/mc.c
src/gtx/keymap.c
src/kauth/admin_tools.c
src/libadmin/cfg/cfgclient.c
src/libadmin/cfg/cfgdb.c
src/libadmin/cfg/cfghost.c
src/libadmin/test/bos.c
src/rx/bulktest/bulk_client.c
src/tools/dumpscan/directory.c
src/tools/dumpscan/pathname.c
src/tools/dumpscan/repair.c
src/tools/dumpscan/stagehdr.c
src/ubik/ubik.c
src/update/utils.c
src/usd/usd_file.c
src/usd/usd_nt.c
src/uss/uss_procs.c
src/uss/uss_vol.c
src/util/dirpath.c
src/util/ktime.c
src/venus/fstrace.c
src/vfsck/main.c
src/viced/afsfileprocs.c
src/vol/partition.c
src/vol/test/listVicepx.c
src/vol/test/utilities.c
src/vol/vol-salvage.c