From: Frederic Marchal Date: Wed, 10 Dec 2014 20:57:56 +0000 (+0100) Subject: Add a comment about a puzzling piece of code X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=acf0b78c5203a65923a07e0798f4a30291a804e8;p=thirdparty%2Fsarg.git Add a comment about a puzzling piece of code The trick to store the same string only once is not clear and deserves a little comment. --- diff --git a/userinfo.c b/userinfo.c index e933861..89be0dd 100644 --- a/userinfo.c +++ b/userinfo.c @@ -111,9 +111,16 @@ struct userinfostruct *userinfo_create(const char *userid,const char *ip) } user->label=user->id; //assign a label to avoid a NULL pointer in case none is provided if (ip) { + /* + * IP address is not the same as the user's ID. A separate buffer + * must be allocated. + */ user->id_is_ip=false; user->ip=StringBuffer_Store(UserStrings,ip); } else { + /* + * User's IP address share the same buffer as the user's ID. + */ user->id_is_ip=true; user->ip=user->id; }