mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-20 05:13:46 -07:00
syntax sugar
This commit is contained in:
parent
a6c50d7de2
commit
20e9931b63
2 changed files with 27 additions and 36 deletions
|
@ -47,8 +47,7 @@ static const poly_t pzero = PZERO;
|
||||||
|
|
||||||
/* Definitions */
|
/* Definitions */
|
||||||
|
|
||||||
void
|
void mcpy(model_t *dest, const model_t *src) {
|
||||||
mcpy(model_t *dest, const model_t *src) {
|
|
||||||
/* Copies the parameters of src to dest.
|
/* Copies the parameters of src to dest.
|
||||||
* dest must be an initialised model.
|
* dest must be an initialised model.
|
||||||
*/
|
*/
|
||||||
|
@ -63,8 +62,7 @@ mcpy(model_t *dest, const model_t *src) {
|
||||||
dest->name = src->name;
|
dest->name = src->name;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void mfree(model_t *model) {
|
||||||
mfree(model_t *model) {
|
|
||||||
/* Frees the parameters of model. */
|
/* Frees the parameters of model. */
|
||||||
if (!model) return;
|
if (!model) return;
|
||||||
pfree(&model->spoly);
|
pfree(&model->spoly);
|
||||||
|
@ -76,8 +74,7 @@ mfree(model_t *model) {
|
||||||
/* not model either, it might point to an array! */
|
/* not model either, it might point to an array! */
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int mcmp(const model_t *a, const model_t *b) {
|
||||||
mcmp(const model_t *a, const model_t *b) {
|
|
||||||
/* Compares a and b for identical effect, i.e. disregarding
|
/* Compares a and b for identical effect, i.e. disregarding
|
||||||
* trailing zeroes in parameter polys.
|
* trailing zeroes in parameter polys.
|
||||||
* Intended for bsearch().
|
* Intended for bsearch().
|
||||||
|
@ -93,8 +90,7 @@ mcmp(const model_t *a, const model_t *b) {
|
||||||
return (psncmp(&a->xorout, &b->xorout));
|
return (psncmp(&a->xorout, &b->xorout));
|
||||||
}
|
}
|
||||||
|
|
||||||
char *
|
char * mtostr(const model_t *model) {
|
||||||
mtostr(const model_t *model) {
|
|
||||||
/* Returns a malloc()-ed string containing a Williams model
|
/* Returns a malloc()-ed string containing a Williams model
|
||||||
* record representing the input model.
|
* record representing the input model.
|
||||||
* mcanon() should be called on the argument before printing.
|
* mcanon() should be called on the argument before printing.
|
||||||
|
@ -154,8 +150,7 @@ mtostr(const model_t *model) {
|
||||||
return(string);
|
return(string);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void mcanon(model_t *model) {
|
||||||
mcanon(model_t *model) {
|
|
||||||
/* canonicalise a model */
|
/* canonicalise a model */
|
||||||
unsigned long dlen;
|
unsigned long dlen;
|
||||||
|
|
||||||
|
@ -181,8 +176,7 @@ mcanon(model_t *model) {
|
||||||
mcheck(model);
|
mcheck(model);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void mcheck(model_t *model) {
|
||||||
mcheck(model_t *model) {
|
|
||||||
/* calculate a check for the model */
|
/* calculate a check for the model */
|
||||||
poly_t checkstr, check, xorout, magic;
|
poly_t checkstr, check, xorout, magic;
|
||||||
|
|
||||||
|
@ -215,8 +209,7 @@ mcheck(model_t *model) {
|
||||||
model->magic = magic;
|
model->magic = magic;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void mrev(model_t *model) {
|
||||||
mrev(model_t *model) {
|
|
||||||
/* reverse the model to calculate reversed CRCs */
|
/* reverse the model to calculate reversed CRCs */
|
||||||
/* Here we invert RefIn and RefOut so that the user need only
|
/* Here we invert RefIn and RefOut so that the user need only
|
||||||
* reverse the order of characters in the arguments, not the
|
* reverse the order of characters in the arguments, not the
|
||||||
|
@ -246,8 +239,7 @@ mrev(model_t *model) {
|
||||||
mnovel(model);
|
mnovel(model);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void mnovel(model_t *model) {
|
||||||
mnovel(model_t *model) {
|
|
||||||
/* remove name and check string from modified model */
|
/* remove name and check string from modified model */
|
||||||
model->name = NULL;
|
model->name = NULL;
|
||||||
pfree(&model->check);
|
pfree(&model->check);
|
||||||
|
|
|
@ -1012,8 +1012,7 @@ void ZLIB_INTERNAL _tr_flush_block(s, buf, stored_len, last)
|
||||||
s->compressed_len += 7; /* align on byte boundary */
|
s->compressed_len += 7; /* align on byte boundary */
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
Tracev((stderr,"\ncomprlen %lu(%lu) ", s->compressed_len>>3,
|
Tracev((stderr,"\ncomprlen %lu(%lu) ", s->compressed_len >> 3, s->compressed_len - 7 * last));
|
||||||
s->compressed_len-7*last));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ===========================================================================
|
/* ===========================================================================
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue