1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2025-03-13 07:33:02 +00:00

(trunk libT) fix build error reported by KyleK and hudson-t

This commit is contained in:
Charles Kerr 2008-12-16 00:57:24 +00:00
parent 9594112d27
commit 48c7c65f1b

View file

@ -44,8 +44,6 @@
#include "platform.h" #include "platform.h"
#include "utils.h" #include "utils.h"
#include <event.h>
/*** /***
**** THREADS **** THREADS
***/ ***/
@ -555,24 +553,23 @@ tr_getClutchDir( const tr_session * session UNUSED )
/* XDG_DATA_DIRS are the backup directories */ /* XDG_DATA_DIRS are the backup directories */
{ {
struct evbuffer * buf = evbuffer_new( ); const char * pkg = PACKAGE_DATA_DIR;
evbuffer_add_printf( buf, "%s:", PACKAGE_DATA_DIR ); const char * xdg = getenv( "XDG_DATA_DIRS" );
if(( tmp = getenv( "XDG_DATA_DIRS" ))) const char * fallback = "/usr/local/share:/usr/share";
evbuffer_add_printf( buf, "%s:", tmp ); char * buf = tr_strdup_printf( "%s:%s:%s", (pkg?pkg:""), (xdg?xdg:""), fallback );
evbuffer_add_printf( buf, "%s:", "/usr/local/share" ); tmp = buf;
evbuffer_add_printf( buf, "%s:", "/usr/share" );
tmp = (const char*) EVBUFFER_DATA( buf );
while( tmp && *tmp ) { while( tmp && *tmp ) {
const char * end = strchr( tmp, ':' ); const char * end = strchr( tmp, ':' );
if( end ) { if( end ) {
tr_list_append( &candidates, tr_strndup( tmp, end - tmp ) ); if( ( end - tmp ) > 1 )
tr_list_append( &candidates, tr_strndup( tmp, end - tmp ) );
tmp = end + 1; tmp = end + 1;
} else if( tmp && *tmp ) { } else if( tmp && *tmp ) {
tr_list_append( &candidates, tr_strdup( tmp ) ); tr_list_append( &candidates, tr_strdup( tmp ) );
break; break;
} }
} }
evbuffer_free( buf ); tr_free( buf );
} }
/* walk through the candidates & look for a match */ /* walk through the candidates & look for a match */