Changeset 6337cb5742f397a3db9201557de56be05c9394a1

Show
Ignore:
Timestamp:
10/20/09 01:28:57 (5 weeks ago)
Author:
Anders Kaseorg <andersk@mit.edu>
git-author:
Anders Kaseorg <andersk@mit.edu> / 2009-10-19T23:27:28Z-0400
Parents:
68f358cfe28c85474e90e129c5e96645d5b86963
Children:
99525be7e6268ba595d424f7f84e31716765f1fc
git-committer:
Anders Kaseorg <andersk@mit.edu> / 2009-10-20T01:28:57Z-0400
Message:
Reimplement zstr with a union, to shut up gcc -Wcast-qual.

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
Files:
1 modified

Legend:

Unmodified
Added
Removed
  • owl.h

    r4f2166b r6337cb5  
    193193 
    194194#ifdef HAVE_LIBZEPHYR 
    195 /* libzephyr doesn't use const, so we appease the type system with this cast. */ 
     195/* libzephyr doesn't use const, so we appease the type system with this kludge. 
     196 * This just casts const char * to char * in a way that doesn't yield a warning 
     197 * from gcc -Wcast-qual. */ 
    196198static inline char *zstr(const char *str) 
    197199{ 
    198   return (char *)str; 
     200  union { char *rw; const char *ro; } u; 
     201  u.ro = str; 
     202  return u.rw; 
    199203} 
    200204#endif