]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
lib: make Curl_gethostname accept a const pointer
authorEmil Engler <me@emilengler.com>
Wed, 26 Aug 2020 19:39:21 +0000 (21:39 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Thu, 27 Aug 2020 20:52:22 +0000 (22:52 +0200)
The address of that variable never gets changed, only the data in it so
why not make it a "char * const"?

Closes #5866

lib/curl_gethostname.c
lib/curl_gethostname.h

index 8337c72e81f3cd49a4aec1d447dffc1a564a3ccc..5f1c9998feffda5a78c3a59f30d9bf897b52896d 100644 (file)
@@ -5,7 +5,7 @@
  *                            | (__| |_| |  _ <| |___
  *                             \___|\___/|_| \_\_____|
  *
- * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
  *
  * This software is licensed as described in the file COPYING, which
  * you should have received as part of this distribution. The terms
@@ -48,7 +48,7 @@
  * For libcurl static library release builds no overriding takes place.
  */
 
-int Curl_gethostname(char *name, GETHOSTNAME_TYPE_ARG2 namelen)
+int Curl_gethostname(char * const name, GETHOSTNAME_TYPE_ARG2 namelen)
 {
 #ifndef HAVE_GETHOSTNAME
 
index 8ae15e6c1945c2a5bb064b93b7569385e297eede..2d78bc54dbd8055bdaf8a1bfa2c936d5f77f3757 100644 (file)
@@ -7,7 +7,7 @@
  *                            | (__| |_| |  _ <| |___
  *                             \___|\___/|_| \_\_____|
  *
- * Copyright (C) 1998 - 2019, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
  *
  * This software is licensed as described in the file COPYING, which
  * you should have received as part of this distribution. The terms
@@ -26,6 +26,6 @@
 #define HOSTNAME_MAX 1024
 
 /* This returns the local machine's un-qualified hostname */
-int Curl_gethostname(char *name, GETHOSTNAME_TYPE_ARG2 namelen);
+int Curl_gethostname(char * const name, GETHOSTNAME_TYPE_ARG2 namelen);
 
 #endif /* HEADER_CURL_GETHOSTNAME_H */