From 72865ad678802c88358f5f0196511f853b501b35 Mon Sep 17 00:00:00 2001 From: Soeren Sonnenburg Date: Fri, 26 Jul 2013 23:32:03 +0200 Subject: [PATCH] move some inline functions to .cpp --- src/shogun/io/SGIO.cpp | 26 ++++++++++++++++++++++++++ src/shogun/io/SGIO.h | 25 ++----------------------- 2 files changed, 28 insertions(+), 23 deletions(-) diff --git a/src/shogun/io/SGIO.cpp b/src/shogun/io/SGIO.cpp index bf9abdf7276..01b114d8a17 100644 --- a/src/shogun/io/SGIO.cpp +++ b/src/shogun/io/SGIO.cpp @@ -366,3 +366,29 @@ uint32_t SGIO::ss_length(substring s) { return (s.end - s.start); } + +char* SGIO::concat_filename(const char* filename) +{ + if (snprintf(file_buffer, FBUFSIZE, "%s/%s", directory_name, filename) > FBUFSIZE) + SG_SERROR("filename too long") + + SG_SDEBUG("filename=\"%s\"\n", file_buffer) + return file_buffer; +} + +int SGIO::filter(CONST_DIRENT_T* d) +{ + if (d) + { + char* fname=concat_filename(d->d_name); + + if (!access(fname, R_OK)) + { + struct stat s; + if (!stat(fname, &s) && S_ISREG(s.st_mode)) + return 1; + } + } + + return 0; +} diff --git a/src/shogun/io/SGIO.h b/src/shogun/io/SGIO.h index 82de297ebba..c05dbe0a43d 100644 --- a/src/shogun/io/SGIO.h +++ b/src/shogun/io/SGIO.h @@ -443,35 +443,14 @@ class SGIO * @param filename new filename * @return concatenated directory and filename */ - static inline char* concat_filename(const char* filename) - { - if (snprintf(file_buffer, FBUFSIZE, "%s/%s", directory_name, filename) > FBUFSIZE) - SG_SERROR("filename too long") - SG_SDEBUG("filename=\"%s\"\n", file_buffer) - return file_buffer; - } + static char* concat_filename(const char* filename); /** filter * * @param d directory entry * @return 1 if d is a readable file */ - static inline int filter(CONST_DIRENT_T* d) - { - if (d) - { - char* fname=concat_filename(d->d_name); - - if (!access(fname, R_OK)) - { - struct stat s; - if (!stat(fname, &s) && S_ISREG(s.st_mode)) - return 1; - } - } - - return 0; - } + static int filter(CONST_DIRENT_T* d); /** * Return a C string from the substring