forked from OSchip/llvm-project
[XRay][compiler-rt] Cleanup some internal XRay utilities
This change uses 'const' for the retryingWriteAll(...) API and removes unnecessary 'static' local variables in getting the temporary filename. llvm-svn: 334267
This commit is contained in:
parent
422a1bbb84
commit
b81372b56b
|
@ -15,11 +15,11 @@
|
|||
#include "sanitizer_common/sanitizer_common.h"
|
||||
#include "xray_defs.h"
|
||||
#include "xray_flags.h"
|
||||
#include <stdlib.h>
|
||||
#include <cstdio>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <iterator>
|
||||
#include <stdlib.h>
|
||||
#include <sys/types.h>
|
||||
#include <tuple>
|
||||
#include <unistd.h>
|
||||
|
@ -31,7 +31,7 @@ void printToStdErr(const char *Buffer) XRAY_NEVER_INSTRUMENT {
|
|||
fprintf(stderr, "%s", Buffer);
|
||||
}
|
||||
|
||||
void retryingWriteAll(int Fd, char *Begin, char *End) XRAY_NEVER_INSTRUMENT {
|
||||
void retryingWriteAll(int Fd, const char *Begin, const char *End) XRAY_NEVER_INSTRUMENT {
|
||||
if (Begin == End)
|
||||
return;
|
||||
auto TotalBytes = std::distance(Begin, End);
|
||||
|
@ -94,10 +94,10 @@ bool readValueFromFile(const char *Filename,
|
|||
|
||||
int getLogFD() XRAY_NEVER_INSTRUMENT {
|
||||
// Open a temporary file once for the log.
|
||||
static char TmpFilename[256] = {};
|
||||
static char TmpWildcardPattern[] = "XXXXXX";
|
||||
auto Argv = GetArgv();
|
||||
const char *Progname = Argv[0] == nullptr ? "(unknown)" : Argv[0];
|
||||
char TmpFilename[256] = {};
|
||||
char TmpWildcardPattern[] = "XXXXXX";
|
||||
auto **Argv = GetArgv();
|
||||
const char *Progname = !Argv ? "(unknown)" : Argv[0];
|
||||
const char *LastSlash = internal_strrchr(Progname, '/');
|
||||
|
||||
if (LastSlash != nullptr)
|
||||
|
|
|
@ -24,7 +24,7 @@ namespace __xray {
|
|||
void printToStdErr(const char *Buffer);
|
||||
|
||||
// EINTR-safe write routine, provided a file descriptor and a character range.
|
||||
void retryingWriteAll(int Fd, char *Begin, char *End);
|
||||
void retryingWriteAll(int Fd, const char *Begin, const char *End);
|
||||
|
||||
// Reads a long long value from a provided file.
|
||||
bool readValueFromFile(const char *Filename, long long *Value);
|
||||
|
|
Loading…
Reference in New Issue