Skip to content

Commit 2a7096c

Browse files
Merge pull request #67 from dreamer-coding/cleanup_impl
Cleaning and refactoring source files
2 parents 163b907 + 1cdf8ca commit 2a7096c

File tree

10 files changed

+298
-348
lines changed

10 files changed

+298
-348
lines changed

.github/workflows/meson_ci.yml

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ on:
77
- "**.h"
88
- "**.cpp"
99
- "**.hpp"
10-
- "**.rs"
1110
- "**.py"
1211
- "**.build"
1312
- "**.options"
@@ -17,7 +16,6 @@ on:
1716
- "**.h"
1817
- "**.cpp"
1918
- "**.hpp"
20-
- "**.rs"
2119
- "**.py"
2220
- "**.build"
2321
- "**.options"
@@ -249,7 +247,7 @@ jobs:
249247
-w /workspace \
250248
${GITHUB_REPOSITORY}:${{ matrix.distro }} \
251249
/bin/bash -c "
252-
apt-get update
250+
sudo apt update
253251
meson setup builddir --fatal-meson-warnings -Dwerror=true -Dwith_test=enabled -Dwarning_level=3
254252
meson compile -C builddir
255253
meson test -C builddir -v"
@@ -275,25 +273,25 @@ jobs:
275273

276274
- name: Install Cross-Compilation Toolchain
277275
run: |
278-
sudo apt-get update
276+
sudo apt update
279277
if [ "${{ matrix.architecture }}" == "arm" ]; then
280-
sudo apt-get install -y gcc-arm-linux-gnueabi g++-arm-linux-gnueabi
278+
sudo apt install -y gcc-arm-linux-gnueabi g++-arm-linux-gnueabi
281279
elif [ "${{ matrix.architecture }}" == "arm64" ]; then
282-
sudo apt-get install -y gcc-aarch64-linux-gnu g++-aarch64-linux-gnu
280+
sudo apt install -y gcc-aarch64-linux-gnu g++-aarch64-linux-gnu
283281
elif [ "${{ matrix.architecture }}" == "mips" ]; then
284-
sudo apt-get install -y gcc-mips-linux-gnu g++-mips-linux-gnu
282+
sudo apt install -y gcc-mips-linux-gnu g++-mips-linux-gnu
285283
elif [ "${{ matrix.architecture }}" == "mipsel" ]; then
286-
sudo apt-get install -y gcc-mipsel-linux-gnu g++-mipsel-linux-gnu
284+
sudo apt install -y gcc-mipsel-linux-gnu g++-mipsel-linux-gnu
287285
elif [ "${{ matrix.architecture }}" == "riscv64" ]; then
288-
sudo apt-get install -y gcc-riscv64-linux-gnu g++-riscv64-linux-gnu
286+
sudo apt install -y gcc-riscv64-linux-gnu g++-riscv64-linux-gnu
289287
elif [ "${{ matrix.architecture }}" == "ppc" ]; then
290-
sudo apt-get install -y gcc-powerpc-linux-gnu g++-powerpc-linux-gnu
288+
sudo apt install -y gcc-powerpc-linux-gnu g++-powerpc-linux-gnu
291289
elif [ "${{ matrix.architecture }}" == "ppc64le" ]; then
292-
sudo apt-get install -y gcc-powerpc64le-linux-gnu g++-powerpc64le-linux-gnu
290+
sudo apt install -y gcc-powerpc64le-linux-gnu g++-powerpc64le-linux-gnu
293291
elif [ "${{ matrix.architecture }}" == "sparc64" ]; then
294-
sudo apt-get install -y gcc-sparc64-linux-gnu g++-sparc64-linux-gnu
292+
sudo apt install -y gcc-sparc64-linux-gnu g++-sparc64-linux-gnu
295293
elif [ "${{ matrix.architecture }}" == "s390x" ]; then
296-
sudo apt-get install -y gcc-s390x-linux-gnu g++-s390x-linux-gnu
294+
sudo apt install -y gcc-s390x-linux-gnu g++-s390x-linux-gnu
297295
fi
298296
299297
- name: Set Cross-Compilation Environment Variables

Dockerfile

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,13 @@ ENV DEBIAN_FRONTEND=noninteractive \
66
TZ=UTC
77

88
# Install system dependencies and clean up
9-
RUN apt-get update && \
10-
apt-get install -y \
9+
RUN apt update && \
10+
apt install -y \
1111
build-essential \
1212
gcc \
1313
g++ \
1414
gdb \
1515
libstdc++-10-dev \
16-
rustc \
17-
cargo \
1816
wget \
1917
python3 \
2018
python3-pip \

code/logic/fossil/test/marking.h

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -41,83 +41,83 @@ typedef struct {
4141
double min_duration;
4242
double max_duration;
4343
int running;
44-
} fossil_benchmark_t;
44+
} fossil_mark_t;
4545

4646
/**
47-
* @brief Initializes a fossil_benchmark_t object with the given name.
48-
* @param benchmark The fossil_benchmark_t object to initialize.
47+
* @brief Initializes a fossil_mark_t object with the given name.
48+
* @param benchmark The fossil_mark_t object to initialize.
4949
* @param name The name of the benchmark.
5050
*/
51-
void fossil_benchmark_init(fossil_benchmark_t* benchmark, const char* name);
51+
void fossil_benchmark_init(fossil_mark_t* benchmark, const char* name);
5252

5353
/**
5454
* @brief Starts the benchmark timer.
55-
* @param benchmark The fossil_benchmark_t object to start.
55+
* @param benchmark The fossil_mark_t object to start.
5656
*/
57-
void fossil_benchmark_start(fossil_benchmark_t* benchmark);
57+
void fossil_benchmark_start(fossil_mark_t* benchmark);
5858

5959
/**
6060
* @brief Stops the benchmark timer.
61-
* @param benchmark The fossil_benchmark_t object to stop.
61+
* @param benchmark The fossil_mark_t object to stop.
6262
*/
63-
void fossil_benchmark_stop(fossil_benchmark_t* benchmark);
63+
void fossil_benchmark_stop(fossil_mark_t* benchmark);
6464

6565
/**
6666
* @brief Returns the total elapsed time in seconds.
67-
* @param benchmark The fossil_benchmark_t object to get the elapsed time from.
67+
* @param benchmark The fossil_mark_t object to get the elapsed time from.
6868
* @return The total elapsed time in seconds.
6969
*/
70-
double fossil_benchmark_elapsed_seconds(const fossil_benchmark_t* benchmark);
70+
double fossil_benchmark_elapsed_seconds(const fossil_mark_t* benchmark);
7171

7272
/**
7373
* @brief Returns the minimum elapsed time in seconds.
74-
* @param benchmark The fossil_benchmark_t object to get the minimum time from.
74+
* @param benchmark The fossil_mark_t object to get the minimum time from.
7575
* @return The minimum elapsed time in seconds.
7676
*/
77-
double fossil_benchmark_min_time(const fossil_benchmark_t* benchmark);
77+
double fossil_benchmark_min_time(const fossil_mark_t* benchmark);
7878

7979
/**
8080
* @brief Returns the maximum elapsed time in seconds.
81-
* @param benchmark The fossil_benchmark_t object to get the maximum time from.
81+
* @param benchmark The fossil_mark_t object to get the maximum time from.
8282
* @return The maximum elapsed time in seconds.
8383
*/
84-
double fossil_benchmark_max_time(const fossil_benchmark_t* benchmark);
84+
double fossil_benchmark_max_time(const fossil_mark_t* benchmark);
8585

8686
/**
8787
* @brief Returns the average elapsed time in seconds.
88-
* @param benchmark The fossil_benchmark_t object to get the average time from.
88+
* @param benchmark The fossil_mark_t object to get the average time from.
8989
* @return The average elapsed time in seconds.
9090
*/
91-
double fossil_benchmark_avg_time(const fossil_benchmark_t* benchmark);
91+
double fossil_benchmark_avg_time(const fossil_mark_t* benchmark);
9292

9393
/**
9494
* @brief Resets the benchmark statistics.
95-
* @param benchmark The fossil_benchmark_t object to reset.
95+
* @param benchmark The fossil_mark_t object to reset.
9696
*/
97-
void fossil_benchmark_reset(fossil_benchmark_t* benchmark);
97+
void fossil_benchmark_reset(fossil_mark_t* benchmark);
9898

9999
/**
100100
* @brief Prints a report of the benchmark statistics.
101-
* @param benchmark The fossil_benchmark_t object to report.
101+
* @param benchmark The fossil_mark_t object to report.
102102
*/
103-
void fossil_benchmark_report(const fossil_benchmark_t* benchmark);
103+
void fossil_benchmark_report(const fossil_mark_t* benchmark);
104104

105105
typedef struct {
106-
fossil_benchmark_t* benchmark;
107-
} scoped_benchmark_t;
106+
fossil_mark_t* benchmark;
107+
} fossil_scoped_mark_t;
108108

109109
/**
110-
* @brief Initializes a scoped_benchmark_t object with the given benchmark.
111-
* @param scoped_benchmark The scoped_benchmark_t object to initialize.
110+
* @brief Initializes a fossil_scoped_mark_t object with the given benchmark.
111+
* @param scoped_benchmark The fossil_scoped_mark_t object to initialize.
112112
* @param benchmark The benchmark to be scoped.
113113
*/
114-
void fossil_scoped_benchmark_init(scoped_benchmark_t* scoped_benchmark, fossil_benchmark_t* benchmark);
114+
void fossil_scoped_benchmark_init(fossil_scoped_mark_t* scoped_benchmark, fossil_mark_t* benchmark);
115115

116116
/**
117-
* @brief Destroys a scoped_benchmark_t object.
118-
* @param scoped_benchmark The scoped_benchmark_t object to destroy.
117+
* @brief Destroys a fossil_scoped_mark_t object.
118+
* @param scoped_benchmark The fossil_scoped_mark_t object to destroy.
119119
*/
120-
void fossil_scoped_benchmark_destroy(scoped_benchmark_t* scoped_benchmark);
120+
void fossil_scoped_benchmark_destroy(fossil_scoped_mark_t* scoped_benchmark);
121121

122122
/**
123123
* Function to test benchmark with specified duration type, expected value, and actual value.
@@ -153,7 +153,7 @@ uint64_t fossil_test_stop_benchmark(void);
153153
* @param name The name of the benchmark.
154154
*/
155155
#define _MARK_BENCHMARK(name) \
156-
fossil_benchmark_t benchmark_##name; \
156+
fossil_mark_t benchmark_##name; \
157157
fossil_benchmark_init(&benchmark_##name, #name)
158158

159159
/**
@@ -199,7 +199,7 @@ uint64_t fossil_test_stop_benchmark(void);
199199
* @param name The name of the benchmark.
200200
*/
201201
#define _MARK_SCOPED(name) \
202-
scoped_benchmark_t scoped_benchmark_##name; \
202+
fossil_scoped_mark_t scoped_benchmark_##name; \
203203
fossil_scoped_benchmark_init(&scoped_benchmark_##name, &benchmark_##name)
204204

205205
// =================================================================

code/logic/fossil/test/mocking.h

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -118,49 +118,49 @@ extern "C" {
118118

119119
// C interface
120120

121-
typedef struct MockCall {
121+
typedef struct fossil_mock_call_t {
122122
char *function_name;
123123
char **arguments;
124124
int num_args;
125-
struct MockCall *next;
126-
} MockCall;
125+
struct fossil_mock_call_t *next;
126+
} fossil_mock_call_t;
127127

128128
typedef struct {
129-
MockCall *head;
130-
MockCall *tail;
129+
fossil_mock_call_t *head;
130+
fossil_mock_call_t *tail;
131131
int size;
132-
} MockCallList;
132+
} fossil_mock_calllist_t;
133133

134134
/**
135-
* Initializes a MockCallList.
135+
* Initializes a fossil_mock_calllist_t.
136136
*
137-
* @param list The MockCallList to initialize.
137+
* @param list The fossil_mock_calllist_t to initialize.
138138
*/
139-
void fossil_mock_init(MockCallList *list);
139+
void fossil_mock_init(fossil_mock_calllist_t *list);
140140

141141
/**
142-
* Destroys a MockCallList and frees all associated memory.
142+
* Destroys a fossil_mock_calllist_t and frees all associated memory.
143143
*
144-
* @param list The MockCallList to destroy.
144+
* @param list The fossil_mock_calllist_t to destroy.
145145
*/
146-
void fossil_mock_destroy(MockCallList *list);
146+
void fossil_mock_destroy(fossil_mock_calllist_t *list);
147147

148148
/**
149-
* Adds a MockCall to the MockCallList.
149+
* Adds a fossil_mock_call_t to the fossil_mock_calllist_t.
150150
*
151-
* @param list The MockCallList to add the MockCall to.
151+
* @param list The fossil_mock_calllist_t to add the fossil_mock_call_t to.
152152
* @param function_name The name of the function being called.
153153
* @param arguments The arguments passed to the function.
154154
* @param num_args The number of arguments.
155155
*/
156-
void fossil_mock_add_call(MockCallList *list, const char *function_name, char **arguments, int num_args);
156+
void fossil_mock_add_call(fossil_mock_calllist_t *list, const char *function_name, char **arguments, int num_args);
157157

158158
/**
159-
* Prints the contents of a MockCallList.
159+
* Prints the contents of a fossil_mock_calllist_t.
160160
*
161-
* @param list The MockCallList to print.
161+
* @param list The fossil_mock_calllist_t to print.
162162
*/
163-
void fossil_mock_print(MockCallList *list);
163+
void fossil_mock_print(fossil_mock_calllist_t *list);
164164

165165
#ifdef __cplusplus
166166
}

0 commit comments

Comments
 (0)