Source-Changes-D archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: CVS commit: src/external/bsd/pkg_install/dist/create



    Date:        Sat, 6 Apr 2019 08:29:02 +0000
    From:        "Robert Elz" <kre%netbsd.org@localhost>
    Message-ID:  <20190406082902.1DA38FB16%cvs.NetBSD.org@localhost>

  | Module Name:	src
  | Committed By:	kre
  | Date:		Sat Apr  6 08:29:02 UTC 2019
  |
  | Modified Files:
  | 	src/external/bsd/pkg_install/dist/create: util.c
  |
  | Log Message:
  | Use __UNCONST() rather than a simple cast to free a const char *
  | while avoiding gcc noise.

Note that a better fix for this would probably be to remove the
const from the fields in the struct definition (in create.h)

As far as I can see, nothing needs (even conceptually) that they
be there - the data is always assigned as

	ptr->owner = xstrdup(whatever);

where xstrdup() is just strdup() + error check, and strdup() is
the canonical way to correctly (if slowly) convert a const char *
into a char * ... making it be const char * again just seems wrong.

However, I will leave it for someone else to determine if that
really is a preferred solution.

kre



Home | Main Index | Thread Index | Old Index