mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-19 00:37:25 +01:00
Use std::min and std::max
This commit is contained in:
@@ -1,10 +1,9 @@
|
||||
#include "console_store.h"
|
||||
#include <string.h>
|
||||
#include <algorithm>
|
||||
|
||||
namespace Code {
|
||||
|
||||
static inline int minInt(int x, int y) { return x < y ? x : y; }
|
||||
|
||||
void ConsoleStore::startNewSession() {
|
||||
if (k_historySize < 1) {
|
||||
return;
|
||||
@@ -103,7 +102,7 @@ const char * ConsoleStore::push(const char marker, const char * text) {
|
||||
i = indexOfNullMarker();
|
||||
}
|
||||
m_history[i] = marker;
|
||||
strlcpy(&m_history[i+1], text, minInt(k_historySize-(i+1),textLength+1));
|
||||
strlcpy(&m_history[i+1], text, std::min(k_historySize-(i+1),textLength+1));
|
||||
m_history[i+1+textLength+1] = 0;
|
||||
return &m_history[i+1];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user