Unsafe_string and C_NULL


#1

I just want to make sure I am not reinventing the wheel here. A library of C functions I am working with return const char * which I want to use as a Julia String. If the string should be empty they return C_NULL. I can easily write a Julia function

unsafe_string_allowing_NULL(ptr::Ptr{UInt8}) = ptr == C_NULL ? "" : unsafe_string(ptr)

but is there an existing idiom for this?


#2

Not that I know of.