Skip to content

Commit

Permalink
#pragma once
Browse files Browse the repository at this point in the history
  • Loading branch information
Lawliet828 committed Apr 28, 2024
1 parent 3e16e43 commit f2f7973
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 12 deletions.
8 changes: 1 addition & 7 deletions muduo/base/LogStream.cc
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ static_assert(sizeof(digits) == 20, "wrong number of digits");
const char digitsHex[] = "0123456789ABCDEF";
static_assert(sizeof digitsHex == 17, "wrong number of digitsHex");

// https://github.com/fmtlib/format-benchmark/blob/master/src/itoa-benchmark/mwilson.cpp
// Efficient Integer to String Conversions, by Matthew Wilson.
template<typename T>
size_t convert(char buf[], T value)
Expand Down Expand Up @@ -205,13 +206,6 @@ std::string formatIEC(int64_t s)

} // namespace muduo

template<int SIZE>
const char* FixedBuffer<SIZE>::debugString()
{
*cur_ = '\0';
return data_;
}

void LogStream::staticCheck()
{
static_assert(kMaxNumericSize - 10 > std::numeric_limits<double>::digits10,
Expand Down
10 changes: 5 additions & 5 deletions muduo/base/LogStream.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
//
// Author: Shuo Chen (chenshuo at chenshuo dot com)

#ifndef MUDUO_BASE_LOGSTREAM_H
#define MUDUO_BASE_LOGSTREAM_H
#pragma once

#include <assert.h>
#include <string.h> // memcpy
Expand Down Expand Up @@ -48,7 +47,10 @@ class FixedBuffer : noncopyable {
void bzero() { memZero(data_, sizeof data_); }

// for used by GDB
const char* debugString();
const char* debugString() {
*cur_ = '\0';
return data_;
}
// for used by unit test
string toString() const { return string(data_, length()); }
StringPiece toStringPiece() const { return StringPiece(data_, length()); }
Expand Down Expand Up @@ -172,5 +174,3 @@ string formatSI(int64_t n);
string formatIEC(int64_t n);

} // namespace muduo

#endif // MUDUO_BASE_LOGSTREAM_H

0 comments on commit f2f7973

Please sign in to comment.