Skip to content

Commit 1eed563

Browse files
committed
merge and minor fixes
1 parent b86e8d9 commit 1eed563

6 files changed

Lines changed: 24 additions & 15 deletions

File tree

kernel/networking/processes/net_proc.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,6 @@ void test_network(void)
261261

262262
if (udp_probe_server(bcast, 8080, &l2, &srv)) {
263263
test_http(srv.ip);
264-
return;
265264
}
266265
http_server_hello_entry();
267266
return;

run_virt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,5 +46,7 @@ $PRIVILEGE qemu-system-aarch64 \
4646
-device virtio-blk-pci,drive=hd0 \
4747
-device qemu-xhci,${MSI_CAPABILITIES}id=usb \
4848
-device usb-kbd,bus=usb.0 \
49+
-device virtio-sound-pci,audiodev=sdl_audio \
50+
-audiodev sdl,id=sdl_audio \
4951
-d guest_errors \
50-
$ARGS
52+
$ARGS

shared/data_struct/data_struct.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
#include "array.hpp"
44
#include "chunked_list.hpp"
5-
// #include "doubly_linked_list.hpp"//TODO: This class needs to be renamed to DoubleLinkedList
5+
#include "double_linked_list.hpp"
66
#include "indexmap.hpp"
77
#include "linked_list.hpp"
88
#include "queue.hpp"
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#include "doubly_linked_list.h"
1+
#include "double_linked_list.h"
22

33
cdouble_linked_list_t* cdouble_linked_list_create(void) {
44
uintptr_t raw = malloc((uint64_t)sizeof(cdouble_linked_list_t));
Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
#include "types.h"
33

44
extern "C" {
5-
#include "doubly_linked_list.h"
5+
#include "double_linked_list.h"
66
}
77

88
template<typename T>
9-
class LinkedList {
9+
class DoubleLinkedList {
1010
private:
1111
struct Node {
1212
T data;
@@ -32,16 +32,24 @@ class LinkedList {
3232
free(n, sizeof(Node));
3333
}
3434

35-
static void swap(LinkedList& a, LinkedList& b) noexcept {
36-
std::swap(a.head, b.head);
37-
std::swap(a.tail, b.tail);
38-
std::swap(a.length, b.length);
35+
static void swap(DoubleLinkedList& a, DoubleLinkedList& b) noexcept {
36+
Node* tmpHead = a.head;
37+
a.head = b.head;
38+
b.head = tmpHead;
39+
40+
Node* tmpTail = a.tail;
41+
a.tail = b.tail;
42+
b.tail = tmpTail;
43+
44+
size_t tmpLen = a.length;
45+
a.length = b.length;
46+
b.length = tmpLen;
3947
}
4048

4149
public:
42-
LinkedList() : head(nullptr), tail(nullptr), length(0) {}
50+
DoubleLinkedList() : head(nullptr), tail(nullptr), length(0) {}
4351

44-
LinkedList(const LinkedList& other) : head(nullptr), tail(nullptr), length(0) {
52+
DoubleLinkedList(const DoubleLinkedList& other) : head(nullptr), tail(nullptr), length(0) {
4553
if (other.head) {
4654
Node* it = other.head;
4755
do {
@@ -51,13 +59,13 @@ class LinkedList {
5159
}
5260
}
5361

54-
~LinkedList() {
62+
~DoubleLinkedList() {
5563
while (!empty()) pop_front();
5664
}
5765

58-
LinkedList& operator=(const LinkedList& other) {
66+
DoubleLinkedList& operator=(const DoubleLinkedList& other) {
5967
if (this != &other) {
60-
LinkedList tmp(other);
68+
DoubleLinkedList tmp(other);
6169
swap(*this, tmp);
6270
}
6371
return *this;

0 commit comments

Comments
 (0)