1
1

On windows make sure we add the initial path separator only if we are

creating a relative path. Use BEGIN_C_DECLS and END_C_DECLS on some
header files.

This commit was SVN r15254.
Этот коммит содержится в:
George Bosilca 2007-07-01 17:51:34 +00:00
родитель 951e4929b9
Коммит 003d1b8665
4 изменённых файлов: 89 добавлений и 103 удалений

Просмотреть файл

@ -25,9 +25,8 @@
#ifndef OPAL_BASENAME_H
#define OPAL_BASENAME_H
#if defined(c_plusplus) || defined(__cplusplus)
extern "C" {
#endif
BEGIN_C_DECLS
/**
* Return the basename of a filename.
*
@ -102,8 +101,6 @@ extern "C" {
*/
OPAL_DECLSPEC char *opal_dirname(const char* filename);
#if defined(c_plusplus) || defined(__cplusplus)
}
#endif
END_C_DECLS
#endif /* OPAL_BASENAME_H */

Просмотреть файл

@ -52,9 +52,7 @@
#include "opal_config.h"
#if defined(c_plusplus) || defined(__cplusplus)
extern "C" {
#endif
BEGIN_C_DECLS
/**
* Convert a size_t to an int.
@ -76,8 +74,6 @@ extern "C" {
*/
OPAL_DECLSPEC int opal_size2int(size_t in, int *out, bool want_check) __opal_attribute_nonnull__(2);
#if defined(c_plusplus) || defined(__cplusplus)
}
#endif
END_C_DECLS
#endif

Просмотреть файл

@ -41,17 +41,11 @@
#define OPAL_OS_DIRPATH_CREATE_H
#include "opal_config.h"
#include <stdio.h>
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#ifdef HAVE_SYS_STAT_H
#include <sys/stat.h>
#endif
#if defined(c_plusplus) || defined(__cplusplus)
extern "C" {
#endif
BEGIN_C_DECLS
/**
* @param path A pointer to a string that contains the path name to be built.
@ -119,8 +113,6 @@ OPAL_DECLSPEC int opal_os_dirpath_destroy(const char *path,
bool recursive,
opal_os_dirpath_destroy_callback_fn_t cbfunc);
#if defined(c_plusplus) || defined(__cplusplus)
}
#endif
END_C_DECLS
#endif

Просмотреть файл

@ -50,6 +50,7 @@ char *opal_os_path(bool relative, ...)
while (NULL != (element = va_arg(ap, char*))) {
num_elements++;
total_length = total_length + strlen(element);
if( path_sep[0] != element[0] ) total_length++;
}
if (0 == num_elements) { /* must be looking for a simple answer */
@ -58,8 +59,7 @@ char *opal_os_path(bool relative, ...)
if (relative) {
strcpy(path, ".");
strcat(path, path_sep);
}
else {
} else {
#ifndef __WINDOWS__
strcpy(path, path_sep);
#endif
@ -90,11 +90,12 @@ char *opal_os_path(bool relative, ...)
/* Windows does not require to have the initial separator. */
if( NULL != (element = va_arg(ap1, char*)) ) {
#ifndef __WINDOWS__
if (path_sep[0] != element[0]) {
#ifdef __WINDOWS__
if( relative )
#endif /* __WINDOWS__ */
strcat(path, path_sep);
}
#endif /* __WINDOWS__ */
strcat(path, element);
}
while (NULL != (element=va_arg(ap1, char*))) {