Skip to content

Commit

Permalink
Update pl-comp.c (offsetof)
Browse files Browse the repository at this point in the history
I understand that offsetof is available since C99, so I don't check for it.
  • Loading branch information
mgondan authored Jul 9, 2024
1 parent 8981f38 commit de534f6
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions src/pl-comp.c
Original file line number Diff line number Diff line change
Expand Up @@ -365,9 +365,7 @@ typedef struct
unsigned int entry[1];
} var_table, *VarTable;

#undef struct_offsetp
#define struct_offsetp(t, f) ((size_t)((t*)4)->f - (size_t)((t*)4))
#define sizeofVarTable(isize) (struct_offsetp(var_table, entry) + sizeof(int)*(isize))
#define sizeofVarTable(isize) (offsetof(var_table, entry) + sizeof(int)*(isize))

This comment has been minimized.

Copy link
@JanWielemaker

JanWielemaker Jul 9, 2024

Member

that is a lot better 😄


#define mkCopiedVarTable(o) copyVarTable(alloca(sizeofVarTable(o->isize)), o)
#define BITSPERINT (int)(sizeof(int)*8)
Expand Down

0 comments on commit de534f6

Please sign in to comment.