]> granicus.if.org Git - check/commit
no longer violate the const part of 'const char *' in send functions.
authorbrarcher <brarcher@64e312b2-a51f-0410-8e61-82d0ca0eb02a>
Sat, 25 Jan 2014 18:18:14 +0000 (18:18 +0000)
committerbrarcher <brarcher@64e312b2-a51f-0410-8e61-82d0ca0eb02a>
Sat, 25 Jan 2014 18:18:14 +0000 (18:18 +0000)
commit0de663b17c25092ddd3a616e91d19ffa38952232
tree8cfcb8d9bb69a81f748729f12e1eefda48a02cf1
parent9d1ecddb4e2162446878117b198e8356a4fe6e73
no longer violate the const part of 'const char *' in send functions.

FailMsg and LocMsg contain char* fields which are not const. Assigning
the passed const char* to a FailMsg or LocMsg violates the const.
To avoid this, a copy of the data is made using strdup. Yes, the
extra copy is functionally unnecessary, but to honor the const
it must be done.

The alternative is to make the char* fields in FailMsg and LocMsg
const. This will not work, however, as those fields are sometimes
assigned malloc'ed data in the code and free'd. You cannot pass
a const pointer to free without a warning.

git-svn-id: svn+ssh://svn.code.sf.net/p/check/code/trunk@1064 64e312b2-a51f-0410-8e61-82d0ca0eb02a
src/check_msg.c