[Swan-dev] code smell
D. Hugh Redelmeier
hugh at mimosa.com
Tue Oct 13 05:26:26 UTC 2020
(This isn't a term that rolls off my tongue, but it is a term of art.)
There is a big chunk of code that is almost identical in
encrypt_v2SK_payload and ikev2_verify_and_decrypt_sk_payload.
It would be good if this code be shared (likely in a function).
This would mean that whenever a change is needed, it will only be needed
one place. For example, I've just fixed a bug that appeared in each. If
they used common code, this would have been just one bug. This isn't the
first pair of bugs that I fixed in this code.
I don't have the time to find the extent of the duplication, but it
includes at least the last IF in each function.
The duplication itself isn't a bug but it is something to be avoided.
That's what the term "smell" so crudely suggests.
Where something "smells" in a piece of code, there is often more than one
thing wrong.
More information about the Swan-dev
mailing list