summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAldrik Ramaekers <aldrikboy@gmail.com>2024-03-15 19:21:35 +0100
committerAldrik Ramaekers <aldrikboy@gmail.com>2024-03-15 19:21:35 +0100
commit9dae91f1993c563cf97a87b84836dc3b6306714a (patch)
treeb0b8ec366fc4d3c64615a1a47222d9f278870d57
parenteeed387a65d9dbdafddffab8e6f8b507262ffaf5 (diff)
remove mem
-rw-r--r--build_linux.sh2
-rw-r--r--build_osx.sh2
-rw-r--r--build_win32.bat4
-rw-r--r--mem/LICENSE.txt21
-rw-r--r--mem/mem.cpp85
-rw-r--r--mem/mem.h11
-rw-r--r--src/array.cpp1
-rw-r--r--src/export.cpp1
-rw-r--r--src/memory_bucket.cpp1
-rw-r--r--src/search.cpp1
-rw-r--r--src/unix/main_unix.cpp1
-rw-r--r--src/windows/main_windows.cpp1
12 files changed, 4 insertions, 127 deletions
diff --git a/build_linux.sh b/build_linux.sh
index cd11be6..291397e 100644
--- a/build_linux.sh
+++ b/build_linux.sh
@@ -9,7 +9,7 @@ if [[ $* == *-release* ]]; then
fi
mkdir -p $OUT_DIR
-g++ -m64 -std=c++17 $FLAGS -DUNICODE -o $OUT_DIR/text-search imgui/imgui*.cpp imgui/backends/imgui_impl_glfw.cpp src/widgets/*.cpp src/*.cpp imfiledialog/*.cpp src/unix/*.cpp mem/mem.cpp -Iimgui -Imem -Iimgui/backends -Isrc -Isrc/unix -pthread -ldl -lglfw -lGLU -lGL
+g++ -m64 -std=c++17 $FLAGS -DUNICODE -o $OUT_DIR/text-search imgui/imgui*.cpp imgui/backends/imgui_impl_glfw.cpp src/widgets/*.cpp src/*.cpp imfiledialog/*.cpp src/unix/*.cpp -Iimgui -Iimgui/backends -Isrc -Isrc/unix -pthread -ldl -lglfw -lGLU -lGL
if [[ $* == *-r* ]]; then
./$OUT_DIR/text-search
diff --git a/build_osx.sh b/build_osx.sh
index 382374d..adb503f 100644
--- a/build_osx.sh
+++ b/build_osx.sh
@@ -14,7 +14,7 @@ mkdir -p $OUT_DIR
# misc items are converted to header files, not embedded. (xxd -i LICENSE misc/osx/LICENSE.h)
-g++ -m64 -std=c++17 $FLAGS -DUNICODE -o $OUT_DIR/text-search imgui/imgui*.cpp imgui/backends/imgui_impl_glfw.cpp src/widgets/*.cpp src/*.cpp imfiledialog/*.cpp src/unix/*.cpp mem/mem.cpp -Iimgui -Imem -Iimgui/backends -Isrc -Isrc/unix -pthread -ldl -lglfw -lGL
+g++ -m64 -std=c++17 $FLAGS -DUNICODE -o $OUT_DIR/text-search imgui/imgui*.cpp imgui/backends/imgui_impl_glfw.cpp src/widgets/*.cpp src/*.cpp imfiledialog/*.cpp src/unix/*.cpp -Iimgui -Iimgui/backends -Isrc -Isrc/unix -pthread -ldl -lglfw -lGL
if [[ $* == *-release* ]]; then
cp $OUT_DIR/text-search misc/text-search.app/Contents/MacOS/text-search
diff --git a/build_win32.bat b/build_win32.bat
index 55acb82..1916414 100644
--- a/build_win32.bat
+++ b/build_win32.bat
@@ -2,7 +2,7 @@ call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary
@set OUT_DIR=bin\\debug
@set OUT_EXE=text-search
@set INCLUDES=/I..\.. /I..\..\backends
-@set SOURCES=imgui/imgui*.cpp src/*.cpp imfiledialog/*.cpp src/windows/*.cpp imgui/backends/imgui_impl_win32.cpp src/widgets/*.cpp mem/mem.cpp
+@set SOURCES=imgui/imgui*.cpp src/*.cpp imfiledialog/*.cpp src/windows/*.cpp imgui/backends/imgui_impl_win32.cpp src/widgets/*.cpp
@set LIBS=opengl32.lib Advapi32.lib Shell32.lib Ole32.lib User32.lib Pathcch.lib bin/debug/icon.res
@set FLAGS=/DTS_DEBUG
windres misc/icon.rc -O coff -o bin/debug/icon.res
@@ -17,6 +17,6 @@ if "%1"=="-release" (
)
mkdir %OUT_DIR%
-cl /std:c++17 /nologo %FLAGS% /W3 /Zi /MD /EHsc /Isrc/windows /external:W0 /external:Iimgui /external:Imem /external:Iimgui/backends /Isrc /utf-8 %INCLUDES% /D UNICODE /D _UNICODE %SOURCES% /Fe%OUT_DIR%/%OUT_EXE%.exe /Fd%OUT_DIR%/vc140.pdb /Fo%OUT_DIR%/ /link %LIBS%
+cl /std:c++17 /nologo %FLAGS% /W3 /Zi /MD /EHsc /Isrc/windows /external:W0 /external:Iimgui /external:Iimgui/backends /Isrc /utf-8 %INCLUDES% /D UNICODE /D _UNICODE %SOURCES% /Fe%OUT_DIR%/%OUT_EXE%.exe /Fd%OUT_DIR%/vc140.pdb /Fo%OUT_DIR%/ /link %LIBS%
if "%1"=="-r" call "bin/debug/text-search.exe"
if "%1"=="-d" call devenv "bin/debug/text-search.exe"
diff --git a/mem/LICENSE.txt b/mem/LICENSE.txt
deleted file mode 100644
index af4ad2e..0000000
--- a/mem/LICENSE.txt
+++ /dev/null
@@ -1,21 +0,0 @@
-The MIT License
-
-Copyright (c) 2015-2018 Bibhas Bhattacharya
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
diff --git a/mem/mem.cpp b/mem/mem.cpp
deleted file mode 100644
index 43f5a89..0000000
--- a/mem/mem.cpp
+++ /dev/null
@@ -1,85 +0,0 @@
-#define _CRT_SECURE_NO_WARNINGS
-
-#include <stdlib.h>
-#include <stdio.h>
-#ifndef _WIN32
-#include <unistd.h>
-#endif
-#pragma warning(disable : 4996)
-void *debug_malloc(size_t size, const char* file, int line) {
- void *p = malloc(size);
-
- if (p == NULL) {
- return NULL;
- }
-
- char buff[256];
-
- sprintf(buff, "bin/debug/mem/%p.mem", p);
-
- FILE *f = fopen(buff, "w");
- if (!f) return p;
- fprintf(f, "File: %s\nLine: %d\nSize: %zu bytes\n", file, line, size);
- fclose(f);
-
- return p;
-}
-
-void *debug_calloc(size_t count, size_t size, const char* file, int line) {
- void *p = calloc(count, size);
-
- if (p == NULL) {
- return NULL;
- }
-
- char buff[256];
-
- sprintf(buff, "bin/debug/mem/%p.mem", p);
-
- FILE *f = fopen(buff, "w");
- if (!f) return p;
-
- fprintf(f, "File: %s\nLine: %d\nSize: %zu bytes\n", file, line,
- count * size);
- fclose(f);
-
- return p;
-}
-
-void *debug_realloc(void *ptr, size_t size, const char* file, int line) {
- void *p = realloc(ptr, size);
-
- if (p == NULL) {
- return NULL;
- }
-
- char buff[256];
- //Delete the old pointer record
- sprintf(buff, "bin/debug/mem/%p.mem", ptr);
- if (ptr != NULL && unlink(buff) < 0) {
- printf("Double free: %p File: %s Line: %d\n", ptr, file, line);
- }
-
- //Create the new pointer record
- sprintf(buff, "bin/debug/mem/%p.mem", p);
-
- FILE *f = fopen(buff, "w");
- if (!f) return p;
-
- fprintf(f, "File: %s\nLine: %d\nSize: %zu bytes\n", file, line, size);
- fclose(f);
-
- return p;
-}
-
-void debug_free(void *p, const char* file, int line) {
- char buff[256];
-
- sprintf(buff, "bin/debug/mem/%p.mem", p);
- if (p != NULL && unlink(buff) < 0) {
- printf("Double free: %p File: %s Line: %d\n", p, file, line);
- }
-
- free(p);
-}
-
diff --git a/mem/mem.h b/mem/mem.h
deleted file mode 100644
index cc6597b..0000000
--- a/mem/mem.h
+++ /dev/null
@@ -1,11 +0,0 @@
-void *debug_malloc(size_t size, const char* file, int line);
-void *debug_calloc(size_t count, size_t size, const char* file, int line);
-void *debug_realloc(void *ptr, size_t size, const char* file, int line);
-void debug_free(void *p, const char* file, int line);
-
-#ifdef TS_DEBUG
-#define malloc(s) debug_malloc(s, __FILE__, __LINE__)
-#define calloc(c, s) debug_calloc(c, s, __FILE__, __LINE__)
-#define realloc(p, s) debug_realloc(p, s, __FILE__, __LINE__)
-#define free(p) debug_free(p, __FILE__, __LINE__)
-#endif
diff --git a/src/array.cpp b/src/array.cpp
index 929a96c..32eb4f3 100644
--- a/src/array.cpp
+++ b/src/array.cpp
@@ -1,6 +1,5 @@
#include "array.h"
#include "config.h"
-#include "mem.h"
#include <stdlib.h>
#include <cstring>
diff --git a/src/export.cpp b/src/export.cpp
index 207a41a..4e316c4 100644
--- a/src/export.cpp
+++ b/src/export.cpp
@@ -1,7 +1,6 @@
#include "export.h"
#include "array.h"
#include "config.h"
-#include "mem.h"
#include <stdio.h>
#ifndef _WIN32
diff --git a/src/memory_bucket.cpp b/src/memory_bucket.cpp
index b465a5f..d846bf1 100644
--- a/src/memory_bucket.cpp
+++ b/src/memory_bucket.cpp
@@ -1,6 +1,5 @@
#include "memory_bucket.h"
#include "config.h"
-#include "mem.h"
#include <stdlib.h>
ts_memory_bucket ts_memory_bucket_init(uint32_t bucket_size)
diff --git a/src/search.cpp b/src/search.cpp
index 2a7d5d6..5138f3b 100644
--- a/src/search.cpp
+++ b/src/search.cpp
@@ -1,7 +1,6 @@
#include "search.h"
#include "platform.h"
#include "config.h"
-#include "mem.h"
#include <stdio.h>
ts_search_result *current_search_result = nullptr;
diff --git a/src/unix/main_unix.cpp b/src/unix/main_unix.cpp
index 906634b..82d9b6d 100644
--- a/src/unix/main_unix.cpp
+++ b/src/unix/main_unix.cpp
@@ -7,7 +7,6 @@
#include "mutex.h"
#include "array.h"
#include "memory_bucket.h"
-#include "mem.h"
#include "image.h"
#include "config.h"
#include <stdio.h>
diff --git a/src/windows/main_windows.cpp b/src/windows/main_windows.cpp
index 1479e79..c47403a 100644
--- a/src/windows/main_windows.cpp
+++ b/src/windows/main_windows.cpp
@@ -8,7 +8,6 @@
#include "platform.h"
#include "mutex.h"
#include "array.h"
-#include "mem.h"
#include "memory_bucket.h"
#include "image.h"
#include "config.h"