Closed vigbalu closed 9 months ago
I can have helper function as below, but seems it can be used only in couple of places. Not possible in (#37 ) because there is a concatenation operation after string is copied. We might have to add another helper function for concatenation which has to free and reallocate memory. I feel helper function would be better if there is more instances of these operations.
Please let me know your thoughts
ompd_rc_t alloc_and_copy_str (const char* str, char new_str) { ompd_rc_t ret; int str_length = strlen(str) + 1/for '\0'/; ret = callbacks->alloc_memory(str_length, (void ) new_str); if (ret != ompd_rc_ok) { return ret; }
strcpy (*new_str, str); return ompd_rc_ok; }
I'm fine either way, we just cannot use static memory here.
Current one is a skeletal implementation and returns "". Implemented to return omp version string.