Avoid relocations in struct BarCodeInfo.
Per Chromium's docs/native_relocations.md, sometimes it makes sense to
restructure read-only data to avoid relocations. In this case, the
results are as follows on Linux:
.rodata: +1376
.data.rel.ro: -1488
.rela.dyn: -1488
So even disregarding the relocation data, which varies on platform, the
amount of read-only data goes down as a result of this change.
Change-Id: I3bf1312d5ec7ef5ac5da346b2e37bf2a22f15bd9
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/74870
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
diff --git a/xfa/fxfa/cxfa_ffbarcode.h b/xfa/fxfa/cxfa_ffbarcode.h
index e744e6a..965c209 100644
--- a/xfa/fxfa/cxfa_ffbarcode.h
+++ b/xfa/fxfa/cxfa_ffbarcode.h
@@ -79,8 +79,10 @@
};
struct BarCodeInfo {
- uint32_t uHash; // |pName| hashed as if wide string.
- const char* pName; // Raw, POD struct.
+ // |pName| hashed as if wide string.
+ uint32_t uHash;
+ // Inline string data reduces size for small strings.
+ const char pName[20];
BarcodeType eName;
BC_TYPE eBCType;
};