boinc/lib/mac/QSymbols.c
// I need to export this for the benefit of the test program.  So it isn't 
// in a header, but it is "extern".
I need to export this for the benefit of the test program.  So it isn't
in a header, but it is "extern".
I need to export this for the benefit of the test program . So it isn ' t in a header but it is " extern " .
extern char *   QSymCreateLibraryNameWithSuffix(const char *libraryName, const char *suffix)
{
    const char *    nameStart;
    const char *    lastDot;
    size_t          libraryNameLen;
    const char *    extension;
    char *          result;
    assert(libraryName != NULL);
    assert(suffix != NULL);
    nameStart = strrchr(libraryName, '/');
    if (nameStart == NULL) {
        nameStart = libraryName;
    } else {
        nameStart += 1;
    }
    lastDot   = strrchr(nameStart, '.');
    libraryNameLen = strlen(libraryName);
    extension      = "";
    if (lastDot != NULL) {
        libraryNameLen = lastDot - libraryName;
        extension      = lastDot;
    }
    result = NULL;
    asprintf(&result, "%.*s%s%s", (int) libraryNameLen, libraryName, suffix, extension);
    return result;
}
extern char * QSymCreateLibraryNameWithSuffix ( const char * libraryName , const char * suffix ) { const char * nameStart ; const char * lastDot ; size_t libraryNameLen ; const char * extension ; char * result ; assert ( libraryName != NULL ) ; assert ( suffix != NULL ) ; nameStart = strrchr ( libraryName , ' ' ) ; if ( nameStart == NULL ) { nameStart = libraryName ; } else { nameStart += 1 ; } lastDot = strrchr ( nameStart , ' ' ) ; libraryNameLen = strlen ( libraryName ) ; extension = " " ; if ( lastDot != NULL ) { libraryNameLen = lastDot - libraryName ; extension = lastDot ; } result = NULL ; asprintf ( & result , " " , ( int ) libraryNameLen , libraryName , suffix , extension ) ; return result ; }
I need to export this for the benefit of the test program.
I need to export this for the benefit of the test program .
// Add the suffix (for example, "_debug") to the library name (for example,  // "/usr/lib/libSystem.B_debug.dylib").  Place the suffix before the extension  // if there is one. // Default to just concatenating the suffix. // If there's an extensiont, break the string at the dot and place the suffix  // between the two.