mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-21 22:03:42 -07:00
Quiet a spurious warning
The compiler warning is incorrect. Since `calloc()` zero's memory, can remove redundant line setting value to zero, giving quieter builds.
This commit is contained in:
parent
18f6604eb0
commit
1c3f84503a
1 changed files with 16 additions and 2 deletions
|
@ -117,17 +117,31 @@ static char *GenerateFilename(const char *prefix, const char *suffix) {
|
||||||
return fptr;
|
return fptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// allocates `items` table entries, storing pointer to `*src`
|
||||||
|
// Each entry stores two keys (A and B), initialized to six-byte value 0xFFFFFFFFFFFF
|
||||||
|
// Each entry also stores whether the key was "found", defaults to false (0)
|
||||||
static int initSectorTable(sector_t **src, size_t items) {
|
static int initSectorTable(sector_t **src, size_t items) {
|
||||||
|
|
||||||
|
|
||||||
|
// typedef struct {
|
||||||
|
// uint64_t Key[2];
|
||||||
|
// uint8_t foundKey[2];
|
||||||
|
// } sector_t;
|
||||||
|
|
||||||
|
// This allocates based on the size of a single item
|
||||||
|
_Static_assert(sizeof(sector_t) >= 18); // if packed, would be 18
|
||||||
|
_Static_assert(sizeof(sector_t) == 24); // not packed, so each entry must be 24 bytes
|
||||||
|
|
||||||
(*src) = calloc(items, sizeof(sector_t));
|
(*src) = calloc(items, sizeof(sector_t));
|
||||||
if (*src == NULL)
|
if (*src == NULL) {
|
||||||
return PM3_EMALLOC;
|
return PM3_EMALLOC;
|
||||||
|
}
|
||||||
|
|
||||||
// empty e_sector
|
// empty e_sector
|
||||||
for (size_t i = 0; i < items; i++) {
|
for (size_t i = 0; i < items; i++) {
|
||||||
for (uint8_t j = 0; j < 2; j++) {
|
for (uint8_t j = 0; j < 2; j++) {
|
||||||
(*src)[i].Key[j] = 0xffffffffffff;
|
(*src)[i].Key[j] = 0xffffffffffff;
|
||||||
(*src)[i].foundKey[j] = 0;
|
// (*src)[i].foundKey[j] = 0; // calloc zero's these already
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return PM3_SUCCESS;
|
return PM3_SUCCESS;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue