chapel-lang/chapel — pull request #101 by sungeunchoi (2014-08-02 00:46:39+00:00)
Title: Make string_length() and string_compare() static inline functions

The runtime functions string_length() and string_compare() simply call the corresponding C library functions, so this commit makes them static inline.

The actual motivation for this change is due to a gcc error/warning from throwing the flag -Werror=free-nonheap-object under some configurations, e.g., CHPL_COMM=gasnet with CHPL_GASNET_SEGMENT=everything. The code in question is in chpl_free_c_string() and is protected by a conditional that checks the length of the string. In the offending case, the memory is guaranteed to be on the heap unless the length is 0, but the length check is made via string_length() which was off in the bowels of the runtime library. Making string_length() static inline makes gcc happy.