[Lldb-commits] [lldb] r125082 - in /lldb/trunk: include/lldb/Host/FileSpec.h source/Core/StreamFile.cpp source/Host/common/FileSpec.cpp
Greg Clayton
gclayton at apple.com
Mon Feb 7 21:19:07 PST 2011
Author: gclayton
Date: Mon Feb 7 23:19:06 2011
New Revision: 125082
URL: http://llvm.org/viewvc/llvm-project?rev=125082&view=rev
Log:
A bit more cleanup with respect to using LLDB_CONFIG_XXX defines outside of
the lldb/source/Host/*.cpp and lldb/source/Host/*/*.cpp directories. The only
offenders are the command completion and the StreamFile.cpp.
I will soon modify StreamFile.cpp to use a lldb/source/Host/File.cpp so that
all file open, close, read, write, seek, are abstracted into the host layer
as well, then this will be gone.
Modified:
lldb/trunk/include/lldb/Host/FileSpec.h
lldb/trunk/source/Core/StreamFile.cpp
lldb/trunk/source/Host/common/FileSpec.cpp
Modified: lldb/trunk/include/lldb/Host/FileSpec.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/FileSpec.h?rev=125082&r1=125081&r2=125082&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Host/FileSpec.h (original)
+++ lldb/trunk/include/lldb/Host/FileSpec.h Mon Feb 7 23:19:06 2011
@@ -15,7 +15,6 @@
#include "lldb/Core/ConstString.h"
#include "lldb/Core/STLUtils.h"
#include "lldb/Host/TimeValue.h"
-#include "lldb/Host/Config.h"
namespace lldb_private {
@@ -521,9 +520,6 @@
static size_t
Resolve (const char *src_path, char *dst_path, size_t dst_len);
-#ifdef LLDB_CONFIG_TILDE_RESOLVES_TO_USER
-
-
//------------------------------------------------------------------
/// Resolves the user name at the beginning of \a src_path, and writes the output
/// to \a dst_path. Note, \a src_path can contain other path components after the
@@ -548,8 +544,6 @@
static size_t
ResolveUsername (const char *src_path, char *dst_path, size_t dst_len);
-#endif
-
enum EnumerateDirectoryResult
{
eEnumerateDirectoryResultNext, // Enumerate next entry in the current directory
Modified: lldb/trunk/source/Core/StreamFile.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/StreamFile.cpp?rev=125082&r1=125081&r2=125082&view=diff
==============================================================================
--- lldb/trunk/source/Core/StreamFile.cpp (original)
+++ lldb/trunk/source/Core/StreamFile.cpp Mon Feb 7 23:19:06 2011
@@ -98,6 +98,8 @@
void
StreamFile::SetLineBuffered ()
{
+ // TODO: check if we can get rid of this LLDB_CONFIG if we do a:
+ // setvbuf(m_file, (char *)NULL, _IOLBF, 0);
#ifdef LLDB_CONFIG_SUPPORTS_SETLINEBUFFERED
if (m_file != NULL)
setlinebuf (m_file);
Modified: lldb/trunk/source/Host/common/FileSpec.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/FileSpec.cpp?rev=125082&r1=125081&r2=125082&view=diff
==============================================================================
--- lldb/trunk/source/Host/common/FileSpec.cpp (original)
+++ lldb/trunk/source/Host/common/FileSpec.cpp Mon Feb 7 23:19:06 2011
@@ -63,6 +63,8 @@
return g_tilde.c_str();
}
+#endif // #ifdef LLDB_CONFIG_TILDE_RESOLVES_TO_USER
+
// Resolves the username part of a path of the form ~user/other/directories, and
// writes the result into dst_path.
// Returns 0 if there WAS a ~ in the path but the username couldn't be resolved.
@@ -71,11 +73,14 @@
size_t
FileSpec::ResolveUsername (const char *src_path, char *dst_path, size_t dst_len)
{
+ if (src_path == NULL || src_path[0] == '\0')
+ return 0;
+
+#ifdef LLDB_CONFIG_TILDE_RESOLVES_TO_USER
+
char user_home[PATH_MAX];
const char *user_name;
- if (src_path == NULL || src_path[0] == '\0')
- return 0;
// If there's no ~, then just copy src_path straight to dst_path (they may be the same string...)
if (src_path[0] != '~')
@@ -133,8 +138,11 @@
return 0;
else
return ::snprintf (dst_path, dst_len, "%s%s", home_dir, remainder);
+#else
+ // Resolving home directories is not supported, just copy the path...
+ return ::snprintf (dst_path, dst_len, "%s", src_path);
+#endif // #ifdef LLDB_CONFIG_TILDE_RESOLVES_TO_USER
}
-#endif // #ifdef LLDB_CONFIG_TILDE_RESOLVES_TO_USER
size_t
FileSpec::Resolve (const char *src_path, char *dst_path, size_t dst_len)
More information about the lldb-commits
mailing list