This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
Hello, This patch introduce directory-separator search routines to libiberty. IMHO filename_cmp.c is suiteable for those functions, but if there are objections about that I can move it into a separate source-file. It helps to avoid a commonly used pattern about dir-separator searching in code, which requires #if-conditions to check if DOS paths are used and introduces additional internal variables. the pattern const char *filename = strrchr (xloc.file, '/'); #ifdef HAVE_DOS_BASED_FILE_SYSTEM const char *filename2 = strrchr (xloc.file, '\\'); if (!filename || (filename2 && filename2 > filename)) filename = filename2; can be written by this patch as const char *filename = filename_dirrchr (xloc.file); ChangeLog include/ 2011-03-08 Kai Tietz * filenames.h (filename_dirchr): New prototype. (filename_dirrchr): Likewise. ChangeLog libiberty/ 2011-03-08 Kai Tietz * filename_cmp.c (filename_dirchr): New function. (filename_dirrchr): Likewise. * functions.texi: Regenerated. Tested for x86_64-pc-linux-gnu and x86_64-w64-mingw32. Ok for apply? Regards, Kai
Attachment:
libiberty_dirsep.txt
Description: Text document
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |