mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-25 16:55:11 +01:00
cgen: swap calloc args
For calloc(nmemb, size), multiplication is commutative, but this still fixes a -Werror=calloc-transposed-args failure with coreboot's compiler.
This commit is contained in:
1 parent
721e574398
commit
5d69840f8e
3 files changed
+32
-32
No files matched your search
@@ -1535,7 +1535,7 @@ func (g *gen) writeInitializerImpl(b *buffer, n *a.Struct) error {
|
||||
return err
|
||||
}
|
||||
b.writes(" {\n")
|
||||
b.printf("%s%s* x =\n(%s%s*)(calloc(sizeof(%s%s), 1));\n",
|
||||
b.printf("%s%s* x =\n(%s%s*)(calloc(1, sizeof(%s%s)));\n",
|
||||
g.pkgPrefix, structName, g.pkgPrefix, structName, g.pkgPrefix, structName)
|
||||
b.writes("if (!x) {\nreturn NULL;\n}\n")
|
||||
b.printf("if (%s%s__initialize(\nx, sizeof(%s%s), "+
|
||||
|
||||
Reference in new issue
Block a user