Fix the #defines for the presence of structure names.

AC_CHECK_MEMBER() and AC_CHECK_MEMBERS() use a standard name for the
{structurename} being the name of the structure type, complete with
"struct" if a typedef wasn't used, and with all letters mapped to upper
case, and with {membername} being the name of the structure member, with
all letters mapped to upper case.

check_struct_has_member() lets you choose the name; choose the same name
that the autoconf macros use, and fix the code to check for them.

Change-Id: Ifb3cf65e7e94907ad0a2f8aacca0c21a531f0c5b
Reviewed-on: https://code.wireshark.org/review/18382
Petri-Dish: Guy Harris <guy@alum.mit.edu>
Reviewed-by: Guy Harris <guy@alum.mit.edu>
This commit is contained in:
Guy Harris 2016-10-22 01:56:48 -07:00
parent d32fee2d62
commit 5f68435a07
4 changed files with 12 additions and 12 deletions

View File

@ -134,10 +134,10 @@ endif()
#Struct members
include(CheckStructHasMember)
check_struct_has_member("struct sockaddr" sa_len sys/socket.h HAVE_SOCKADDR_SA_LEN)
check_struct_has_member("struct stat" st_flags sys/stat.h HAVE_STAT_ST_FLAGS)
check_struct_has_member("struct stat" st_birthtime sys/stat.h HAVE_STAT_ST_BIRTHTIME)
check_struct_has_member("struct stat" __st_birthtime sys/stat.h HAVE_STAT___ST_BIRTHTIME)
check_struct_has_member("struct sockaddr" sa_len sys/socket.h HAVE_STRUCT_SOCKADDR_SA_LEN)
check_struct_has_member("struct stat" st_flags sys/stat.h HAVE_STRUCT_STAT_ST_FLAGS)
check_struct_has_member("struct stat" st_birthtime sys/stat.h HAVE_STRUCT_STAT_ST_BIRTHTIME)
check_struct_has_member("struct stat" __st_birthtime sys/stat.h HAVE_STRUCT_STAT___ST_BIRTHTIME)
check_struct_has_member("struct tm" tm_zone time.h HAVE_STRUCT_TM_TM_ZONE)
#Symbols but NOT enums or types

View File

@ -278,7 +278,7 @@ get_interface_list(int *err, char **err_str)
}
next:
#ifdef HAVE_SOCKADDR_SA_LEN
#ifdef HAVE_STRUCT_SOCKADDR_SA_LEN
ifr = (struct ifreq *) ((char *) ifr +
(ifr->ifr_addr.sa_len > sizeof(ifr->ifr_addr) ?
ifr->ifr_addr.sa_len : sizeof(ifr->ifr_addr)) +

View File

@ -295,7 +295,7 @@
#cmakedefine HAVE_REMOTE 1
/* Define if sa_len field exists in struct sockaddr */
#cmakedefine HAVE_SOCKADDR_SA_LEN 1
#cmakedefine HAVE_STRUCT_SOCKADDR_SA_LEN 1
/* Define to 1 if you want to playing SBC by standalone BlueZ SBC library */
#cmakedefine HAVE_SBC 1
@ -322,7 +322,7 @@
#cmakedefine HAVE_STRUCT_STAT_ST_BIRTHTIME 1
/* Define if st_flags field exists in struct stat */
#cmakedefine HAVE_STAT_ST_FLAGS 1
#cmakedefine HAVE_STRUCT_STAT_ST_FLAGS 1
/* Define to 1 if `__st_birthtime' is a member of `struct stat'. */
#cmakedefine HAVE_STRUCT_STAT___ST_BIRTHTIME 1

View File

@ -304,9 +304,9 @@ file_target_unwritable_ui(GtkWidget *chooser_w, char *cf_name)
return TRUE;
}
/* OK, we have the permission bits and, if HAVE_STAT_ST_FLAGS is defined,
the flags. (If we don't, we don't worry about it.) */
#ifdef HAVE_STAT_ST_FLAGS
/* OK, we have the permission bits and, if HAVE_STRUCT_STAT_ST_FLAGS
is defined, the flags. (If we don't, we don't worry about it.) */
#ifdef HAVE_STRUCT_STAT_ST_FLAGS
if (statbuf.st_flags & UF_IMMUTABLE) {
display_basename = g_filename_display_basename(cf_name);
msg_dialog = gtk_message_dialog_new(GTK_WINDOW(chooser_w),
@ -325,7 +325,7 @@ file_target_unwritable_ui(GtkWidget *chooser_w, char *cf_name)
display_basename);
g_free(display_basename);
} else
#endif /* HAVE_STAT_ST_FLAGS */
#endif /* HAVE_STRUCT_STAT_ST_FLAGS */
if ((statbuf.st_mode & (S_IWUSR|S_IWGRP|S_IWOTH)) == 0) {
display_basename = g_filename_display_basename(cf_name);
msg_dialog = gtk_message_dialog_new(GTK_WINDOW(chooser_w),
@ -358,7 +358,7 @@ file_target_unwritable_ui(GtkWidget *chooser_w, char *cf_name)
return FALSE;
}
#ifdef HAVE_STAT_ST_FLAGS
#ifdef HAVE_STRUCT_STAT_ST_FLAGS
/* OK, they want to overwrite the file. If it has the "user
immutable" flag, we have to turn that off first, so we
can move on top of, or overwrite, the file. */