Skip to content

Commit

Permalink
Removed some tracing that was unneccessary
Browse files Browse the repository at this point in the history
  • Loading branch information
Meulengracht committed Feb 8, 2021
1 parent b0be9d3 commit f7647d3
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 22 deletions.
6 changes: 1 addition & 5 deletions kernel/output/log.c
Original file line number Diff line number Diff line change
Expand Up @@ -127,10 +127,6 @@ LogRenderMessages(void)
SystemLogLine_t* logLine;
Thread_t* thread;
char sprintBuffer[256];

if (!g_kernelLog.AllowRender) {
return;
}

while (g_kernelLog.RenderIndex != g_kernelLog.LineIndex) {

Expand All @@ -155,7 +151,7 @@ LogRenderMessages(void)
thread ? ThreadName(thread) : "boot",
&logLine->data[0]);
__WriteMessageToSerial(&sprintBuffer[0]);
if (logLine->level >= LOG_DEBUG) {
if (logLine->level >= LOG_DEBUG && g_kernelLog.AllowRender) {
__WriteMessageToScreen(&sprintBuffer[0]);
}
}
Expand Down
2 changes: 1 addition & 1 deletion librt/libc/stdio/io/flsbuf.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ _flsbuf(
{
int count, written, res;
TCHAR charTyped = (TCHAR)(ch & (sizeof(TCHAR) > sizeof(char) ? 0xffff : 0xff));
TRACE("_flsbuf(ch=%i, stream=0x%" PRIxIN ", stream->_flag=%i)", ch, stream, stream->_flag);
TRACE("_flsbuf(ch=%i, stream=0x%" PRIxIN ", stream->_flag=0x%x)", ch, stream, stream->_flag);

// Check if the stream supports flushing
res = __can_flush_otherwise_set_IOERR(stream);
Expand Down
30 changes: 19 additions & 11 deletions librt/libc/stdio/io/fread.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,25 @@
#include <stdlib.h>
#include <limits.h>

static inline void __set_eof(stdio_handle_t* handle)
{
if (handle->object.type == STDIO_HANDLE_FILE) {
handle->wxflag |= WX_ATEOF;
}
}

static int
__read_as_binary(stdio_handle_t* handle, char* buf, unsigned int count)
{
char* pointer = buf;
size_t bytesRead;
char* pointer = buf;
size_t bytesRead;
OsStatus_t status;

if (handle->ops.read(handle, pointer, count, &bytesRead) == OsSuccess) {
status = handle->ops.read(handle, pointer, count, &bytesRead);
if (status == OsSuccess) {
// Test against EOF
if (count != 0 && bytesRead == 0) {
handle->wxflag |= WX_ATEOF;
__set_eof(handle);
}
return (int)bytesRead;
}
Expand Down Expand Up @@ -113,7 +122,7 @@ __read_as_utf8(stdio_handle_t* handle, wchar_t *buf, unsigned int count)
if (count < 4) {
if(!pos && handle->ops.read(handle, readbuf, 1, &bytesRead) == OsSuccess) {
if(!bytesRead) {
handle->wxflag |= WX_ATEOF;
__set_eof(handle);
if (readbuf != &min_buf[0]) {
free(readbuf);
}
Expand Down Expand Up @@ -142,7 +151,7 @@ __read_as_utf8(stdio_handle_t* handle, wchar_t *buf, unsigned int count)

// Check for ctrl-z
if(readbuf[0] == 0x1a) {
handle->wxflag |= WX_ATEOF;
__set_eof(handle);
if (readbuf != &min_buf[0]) {
free(readbuf);
}
Expand Down Expand Up @@ -189,8 +198,7 @@ __read_as_utf8(stdio_handle_t* handle, wchar_t *buf, unsigned int count)
if (handle->ops.read(handle, readbuf + pos, readbuf_size - pos, &bytesRead) != OsSuccess) {
// EOF?
if (!pos && !bytesRead) {
handle->wxflag |= WX_ATEOF;

__set_eof(handle);
if (readbuf != &min_buf[0]) {
free(readbuf);
}
Expand Down Expand Up @@ -252,7 +260,7 @@ __read_as_utf8(stdio_handle_t* handle, wchar_t *buf, unsigned int count)
for (i = 0, j = 0; i < pos; i++) {
// Check for ctrl-z
if (readbuf[i] == 0x1a) {
handle->wxflag |= WX_ATEOF;
__set_eof(handle);
break;
}

Expand Down Expand Up @@ -347,7 +355,7 @@ __read_as_text_or_wide(stdio_handle_t* handle, char* buf, unsigned int count)

// Test against EOF
if (count != 0 && bytesRead == 0) {
handle->wxflag |= WX_ATEOF;
__set_eof(handle);
}
else {
size_t i, j;
Expand All @@ -364,7 +372,7 @@ __read_as_text_or_wide(stdio_handle_t* handle, char* buf, unsigned int count)
{
// In text mode, a ctrl-z signals EOF
if (bufferPointer[i] == 0x1a && (!isUtf16 || bufferPointer[i + 1] == 0)) {
handle->wxflag |= WX_ATEOF;
__set_eof(handle);
break;
}

Expand Down
8 changes: 4 additions & 4 deletions modules/filesystems/mfs/records.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
* - Contains the implementation of the MFS driver for mollenos
*/

#define __TRACE
//#define __TRACE

#include <ddk/utils.h>
#include "mfs.h"
Expand Down Expand Up @@ -203,8 +203,8 @@ static OsStatus_t __FindEntryOrFreeInDirectoryBucket(
// and try to match it with our token (ignore case)
filename = MStringCreate((const char*)&record->Name[0], StrUTF8);
compareResult = MStringCompare(entryName, filename, 1);
TRACE("__FindEntryOrFreeInDirectoryBucket matching token %s == %s: %i",
MStringRaw(entryName), MStringRaw(filename), compareResult);
//TRACE("__FindEntryOrFreeInDirectoryBucket matching token %s == %s: %i",
// MStringRaw(entryName), MStringRaw(filename), compareResult);
MStringDestroy(filename);

if (compareResult == MSTRING_FULL_MATCH) {
Expand Down Expand Up @@ -440,7 +440,7 @@ MfsCreateRecord(
MString_t* currentToken = NULL;
int isEndOfPath = 0;

TRACE("MfsCreateRecord(fileSystem=0x%" PRIxIN "flags=0x%x, bucketOfDirectory=%u, path=%s [0x%" PRIxIN "])",
TRACE("MfsCreateRecord(fileSystem=0x%" PRIxIN ", flags=0x%x, bucketOfDirectory=%u, path=%s [0x%" PRIxIN "])",
fileSystem, flags, bucketOfDirectory, MStringRaw(path), path);

if (!fileSystem) {
Expand Down
2 changes: 1 addition & 1 deletion services/filemanager/functions.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
* - Handles all file related services and disk services
*/

#define __TRACE
//#define __TRACE

#include <ctype.h>
#include <ddk/utils.h>
Expand Down

0 comments on commit f7647d3

Please sign in to comment.