summaryrefslogtreecommitdiff
path: root/modules/xgetdomainname
Commit message (Collapse)AuthorAgeFilesLines
* xgetdomainname: Ensure .c file starts with '#include <config.h>'.Bruno Haible2021-08-071-1/+3
| | | | | | | | | | * lib/xgetaname-impl.h: New file, based on lib/xgethostname.c. * lib/xgethostname.c: Move implementation to lib/xgetaname-impl.h. * lib/xgetdomainname.c: Include <config.h>. Include xgetaname-impl.h instead of xgethostname.c. * modules/xgethostname (Files): Add lib/xgetaname-impl.h. * modules/xgetdomainname (Files): Likewise. (Depends-on): Remove xgethostname. Add free-posix, xalloc.
* xgethostname: reorganize / simplifyPaul Eggert2021-04-031-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | xgethostname and xgetdomainname were essentially copies long ago, but they’ve diverged. Bring them back together again by implementing the (rarely used) latter in terms of the former. And avoid some unnecessary realloc calls while we’re at it. * lib/xgetdomainname.c: Rewrite from scratch so that it merely includes xgethostname.c with a few preliminaries. * lib/xgethostname.c: Generalize so that it can be included from xgetdomainname.c. (GETANAME, XGETANAME): New macros. (INITIAL_HOSTNAME_LENGTH): Remove. No need for this parameter. Use 100 instead, as few hostnames are longer than that. (XGETANAME): Try getting the hostname into the stack first, as that avoids a malloc call in the usual case. Check for both POSIX-style truncation and SunOS 5.5 bug in a cleaner way, by simply checking string length. Don’t use x2realloc, which wastes time preserving buffer garbage; use xpalloc with NULL instead. Don’t bother shrinking buffer in the very rare case where the hostname is longer than sizeof buf; it’s not worth the aggravation. * modules/xgetdomainname (Depends-on): Remove free-posix, xalloc. Add xgethostname.
* free-posix: use more often in other modulesPaul Eggert2021-03-251-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This lets us simplify cleanup code that calls ‘free’. * lib/amemxfrm.c (amemxfrm): * lib/areadlink-with-size.c (areadlink_with_size): * lib/areadlinkat-with-size.c (areadlinkat_with_size): * lib/astrxfrm.c (astrxfrm): * lib/dprintf.c (dprintf): * lib/execute.c (execute): * lib/execvpe.c (execvpe): * lib/fchdir.c (get_name): * lib/file-has-acl.c (file_has_acl): * lib/fprintf.c (fprintf): * lib/getcwd-lgpl.c (rpl_getcwd): * lib/getgroups.c (rpl_getgroups): * lib/link.c (link, rpl_link): * lib/linkat.c (link_immediate, link_follow, linkat_follow): * lib/localename.c (newlocale, duplocale): * lib/mgetgroups.c (mgetgroups): * lib/mountlist.c (read_file_system_list): * lib/pipe-filter-gi.c (pipe_filter_gi_close): * lib/putenv.c (_unsetenv, putenv): * lib/read-file.c (read_file): * lib/rename.c (rpl_rename): * lib/savedir.c (streamsavedir, savedir): * lib/spawni.c (do_open, __spawni): * lib/spawn-pipe.c (create_pipe): * lib/striconv.c (mem_cd_iconv, str_cd_iconv, str_iconv): * lib/striconveh.c (mem_cd_iconveh_internal, str_cd_iconveh) (mem_iconveh, str_iconveh): * lib/supersede.c (open_supersede, close_supersede): * lib/vasnprintf.c (VASNPRINTF): * lib/vdprintf.c (vdprintf): * lib/vfprintf.c (vfprintf): * lib/wcscoll-impl.h (wcscoll): * lib/wcsxfrm-impl.h (wcsxfrm): * lib/xgetdomainname.c (xgetdomainname): * lib/xgethostname.c (xgethostname): Simplify by assuming that ‘free’ preserves errno. * lib/localename.c: Do not include errno.h. * modules/amemxfrm, modules/areadlink-with-size: * modules/areadlinkat-with-size, modules/astrxfrm: * modules/c-vasnprintf, modules/dprintf, modules/execute: * modules/execvpe, modules/fchdir, modules/file-has-acl: * modules/fprintf-posix, modules/getcwd-lgpl, modules/getgroups: * modules/link, modules/linkat, modules/localename: * modules/mgetgroups, modules/mountlist, modules/pipe-filter-gi: * modules/posix_spawn-internal, modules/putenv, modules/read-file: * modules/rename, modules/savedir, modules/spawn-pipe: * modules/striconv, modules/striconveh, modules/supersede: * modules/vasnprintf, modules/vdprintf, modules/vfprintf-posix: * modules/wcscoll, modules/wcsxfrm, modules/xgetdomainname: * modules/xgethostname: Depend on free-posix.
* Add a license tag to every module.Bruno Haible2004-09-221-0/+3
|
* Tweak Include section.Bruno Haible2003-10-021-0/+1
|
* New modules 'xgetdomainname'.Bruno Haible2003-09-251-0/+20