mirror of
https://git.freebsd.org/ports.git
synced 2025-05-25 15:36:35 -04:00
26 lines
923 B
Text
26 lines
923 B
Text
--- src/output.cc 2007-03-31 15:16:05 UTC
|
|
+++ src/output.cc
|
|
@@ -1106,9 +1106,7 @@ output_keyword_entry (KeywordExt *temp,
|
|
if (option[TYPE])
|
|
printf ("{");
|
|
if (option[SHAREDLIB])
|
|
- printf ("(int)(long)&((struct %s_t *)0)->%s_str%d",
|
|
- option.get_stringpool_name (), option.get_stringpool_name (),
|
|
- stringpool_index);
|
|
+ printf("offsetof(struct %s_t, %s_str%d)", option.get_stringpool_name (), option.get_stringpool_name (), stringpool_index);
|
|
else
|
|
output_string (temp->_allchars, temp->_allchars_length);
|
|
if (option[TYPE])
|
|
@@ -2035,8 +2033,11 @@ Output::output ()
|
|
printf ("%s\n", _struct_decl);
|
|
}
|
|
|
|
- if (option[INCLUDE])
|
|
+ if (option[INCLUDE]) {
|
|
printf ("#include <string.h>\n"); /* Declare strlen(), strcmp(), strncmp(). */
|
|
+ if (option[SHAREDLIB])
|
|
+ printf("#include <stddef.h>\n"); /* Declare offsetof() */
|
|
+ }
|
|
|
|
if (!option[ENUM])
|
|
{
|