In-progress work: refactoring PAL not to be instanced.

This removes a lot of useless passing around of the PAL object.
This commit is contained in:
Ben Vanik
2013-03-29 05:07:32 -07:00
parent c46093266e
commit 85bdbd24d1
45 changed files with 444 additions and 189 deletions

View File

@@ -23,8 +23,7 @@ typedef struct xe_file {
#endif // WIN32
xe_file_ref xe_file_open(xe_pal_ref pal, const xe_file_mode mode,
const xechar_t *path) {
xe_file_ref xe_file_open(const xe_file_mode mode, const xechar_t *path) {
xe_file_ref file = (xe_file_ref)xe_calloc(sizeof(xe_file_t));
xe_ref_init((xe_ref)file);
@@ -83,27 +82,3 @@ size_t xe_file_read(xe_file_ref file, const size_t offset,
return fread(buffer, 1, buffer_size, handle);
}
void xe_path_join(const xechar_t* left, const xechar_t* right,
xechar_t* out_path, size_t out_path_size) {
#if XE_WCHAR
xesnprintf(out_path, out_path_size, XT("%ls%c%ls"),
left, XE_PATH_SEPARATOR, right);
#else
xesnprintf(out_path, out_path_size, XT("%s%c%s"),
left, XE_PATH_SEPARATOR, right);
#endif // XE_WCHAR
}
void xe_path_get_absolute(const xechar_t* path, xechar_t* out_abs_path,
size_t abs_path_size) {
#if XE_PLATFORM(WIN32)
#if XE_WCHAR
_wfullpath(out_abs_path, path, abs_path_size);
#else
_fullpath(out_abs_path, path, abs_path_size);
#endif // XE_WCHAR
#else
realpath(path, out_abs_path);
#endif // WIN32
}