Skip to content
This repository has been archived by the owner on Nov 17, 2020. It is now read-only.

Commit

Permalink
Use sizeof() instead of hard-coding struct sizes
Browse files Browse the repository at this point in the history
svn path=/trunk/; revision=946
  • Loading branch information
Colin Walters committed Nov 18, 2008
1 parent eef4613 commit a536b3f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
5 changes: 5 additions & 0 deletions ChangeLog
@@ -1,3 +1,8 @@
2008-11-18 Andreas Rottmann <a.rottmann@gmx.at>

* girepository/girnode.c (g_ir_node_build_typelib): Use sizeof()
instead of hard-coding struct sizes.

2008-11-18 Owen Taylor <otaylor@redhat.com>

Bug 561296 - Add "storage type" to the typelib data for enums
Expand Down
16 changes: 8 additions & 8 deletions girepository/girnode.c
Expand Up @@ -1576,8 +1576,8 @@ g_ir_node_build_typelib (GIrNode *node,
signature = *offset2;
n = g_list_length (function->parameters);

*offset += 16;
*offset2 += 8 + n * 12;
*offset += sizeof(FunctionBlob);
*offset2 += sizeof(SignatureBlob) + n * sizeof(ArgBlob);

blob->blob_type = BLOB_TYPE_FUNCTION;
blob->deprecated = function->deprecated;
Expand Down Expand Up @@ -1628,8 +1628,8 @@ g_ir_node_build_typelib (GIrNode *node,
signature = *offset2;
n = g_list_length (function->parameters);

*offset += 12;
*offset2 += 8 + n * 12;
*offset += sizeof(CallbackBlob);
*offset2 += sizeof(SignatureBlob) + n * sizeof(ArgBlob);

blob->blob_type = BLOB_TYPE_CALLBACK;
blob->deprecated = function->deprecated;
Expand Down Expand Up @@ -1671,8 +1671,8 @@ g_ir_node_build_typelib (GIrNode *node,
signature = *offset2;
n = g_list_length (signal->parameters);

*offset += 12;
*offset2 += 8 + n * 12;
*offset += sizeof(SignalBlob);
*offset2 += sizeof(SignatureBlob) + n * sizeof(ArgBlob);

blob->deprecated = signal->deprecated;
blob->run_first = signal->run_first;
Expand Down Expand Up @@ -1722,8 +1722,8 @@ g_ir_node_build_typelib (GIrNode *node,
signature = *offset2;
n = g_list_length (vfunc->parameters);

*offset += 16;
*offset2 += 8 + n * 12;
*offset += sizeof(VFuncBlob);
*offset2 += sizeof(SignatureBlob) + n * sizeof(ArgBlob);

blob->name = write_string (node->name, strings, data, offset2);
blob->must_chain_up = 0; /* FIXME */
Expand Down

0 comments on commit a536b3f

Please sign in to comment.