Skip to content

Commit 3720140

Browse files
authored
Merge branch 'sysprog21:master' into master
2 parents 0076eb3 + 3c7c7b3 commit 3720140

File tree

5 files changed

+18
-17
lines changed

5 files changed

+18
-17
lines changed

dudect/fixture.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,8 +170,11 @@ static bool test_const(char *text, int mode)
170170
return result;
171171
}
172172

173-
#define DUT_FUNC_IMPL(op) \
174-
bool is_##op##_const(void) { return test_const(#op, DUT(op)); }
173+
#define DUT_FUNC_IMPL(op) \
174+
bool is_##op##_const(void) \
175+
{ \
176+
return test_const(#op, DUT(op)); \
177+
}
175178

176179
#define _(x) DUT_FUNC_IMPL(x)
177180
DUT_FUNCS

list.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -457,8 +457,8 @@ static inline void list_move_tail(struct list_head *node,
457457
&entry->member != (head); entry = safe, \
458458
safe = list_entry(safe->member.next, typeof(*entry), member))
459459
#else
460-
#define list_for_each_entry_safe(entry, safe, head, member) \
461-
for (entry = (void *) 1; sizeof(struct { int i : -1; }); \
460+
#define list_for_each_entry_safe(entry, safe, head, member) \
461+
for (entry = safe = (void *) 1; sizeof(struct { int i : -1; }); \
462462
++(entry), ++(safe))
463463
#endif
464464

qtest.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -434,7 +434,7 @@ static bool do_dedup(int argc, char *argv[])
434434

435435
// Copy current->q to l_copy
436436
if (current->q && !list_empty(current->q)) {
437-
list_for_each_entry (item, current->q, list) {
437+
list_for_each_entry(item, current->q, list) {
438438
size_t slen;
439439
tmp = malloc(sizeof(element_t));
440440
if (!tmp)
@@ -451,7 +451,7 @@ static bool do_dedup(int argc, char *argv[])
451451
}
452452
// Return false if the loop does not leave properly
453453
if (&item->list != current->q) {
454-
list_for_each_entry_safe (item, tmp, &l_copy, list) {
454+
list_for_each_entry_safe(item, tmp, &l_copy, list) {
455455
free(item->value);
456456
free(item);
457457
}
@@ -468,7 +468,7 @@ static bool do_dedup(int argc, char *argv[])
468468
exception_cancel();
469469

470470
if (!ok) {
471-
list_for_each_entry_safe (item, tmp, &l_copy, list) {
471+
list_for_each_entry_safe(item, tmp, &l_copy, list) {
472472
free(item->value);
473473
free(item);
474474
}
@@ -479,7 +479,7 @@ static bool do_dedup(int argc, char *argv[])
479479
struct list_head *l_tmp = current->q->next;
480480
bool is_this_dup = false;
481481
// Compare between new list and old one
482-
list_for_each_entry (item, &l_copy, list) {
482+
list_for_each_entry(item, &l_copy, list) {
483483
// Skip comparison with new list if the string is duplicate
484484
bool is_next_dup =
485485
item->list.next != &l_copy &&
@@ -503,7 +503,7 @@ static bool do_dedup(int argc, char *argv[])
503503
"ERROR: Duplicate strings are in queue or distinct strings are "
504504
"not in queue");
505505

506-
list_for_each_entry_safe (item, tmp, &l_copy, list) {
506+
list_for_each_entry_safe(item, tmp, &l_copy, list) {
507507
free(item->value);
508508
free(item);
509509
}
@@ -544,7 +544,7 @@ static bool do_size(int argc, char *argv[])
544544
bool ok = true;
545545
if (argc == 2) {
546546
if (!get_int(argv[1], &reps))
547-
report(1, "Invalid number of calls to size '%s'", argv[2]);
547+
report(1, "Invalid number of calls to size '%s'", argv[1]);
548548
}
549549

550550
int cnt = 0;
@@ -604,7 +604,7 @@ bool do_sort(int argc, char *argv[])
604604
unsigned no = 0;
605605
if (current && current->size && current->size <= MAX_NODES) {
606606
element_t *entry;
607-
list_for_each_entry (entry, current->q, list)
607+
list_for_each_entry(entry, current->q, list)
608608
nodes[no++] = &entry->list;
609609
} else if (current && current->size > MAX_NODES)
610610
report(1,

queue.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -201,13 +201,12 @@ void q_reverseK(struct list_head *head, int k);
201201
void q_sort(struct list_head *head, bool descend);
202202

203203
/**
204-
* q_ascend() - Remove every node which has a node with a strictly less
204+
* q_ascend() - Delete every node which has a node with a strictly less
205205
* value anywhere to the right side of it.
206206
* @head: header of queue
207207
*
208208
* No effect if queue is NULL or empty. If there has only one element, do
209209
* nothing.
210-
* Memory allocated to removed nodes must be freed.
211210
*
212211
* Reference:
213212
* https://leetcode.com/problems/remove-nodes-from-linked-list/
@@ -217,13 +216,12 @@ void q_sort(struct list_head *head, bool descend);
217216
int q_ascend(struct list_head *head);
218217

219218
/**
220-
* q_descend() - Remove every node which has a node with a strictly greater
219+
* q_descend() - Delete every node which has a node with a strictly greater
221220
* value anywhere to the right side of it.
222221
* @head: header of queue
223222
*
224223
* No effect if queue is NULL or empty. If there has only one element, do
225224
* nothing.
226-
* Memory allocated to removed nodes must be freed.
227225
*
228226
* Reference:
229227
* https://leetcode.com/problems/remove-nodes-from-linked-list/

scripts/checksums

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
398b59c23f699ff1bf1e73a94503a9a91caa9207 queue.h
2-
5179cf8f5aafbc6cb8e8d7b898ef3798cfe85613 list.h
1+
bff0704601c8197ae6b847647b4167664b7d6abc queue.h
2+
b26e079496803ebe318174bda5850d2cce1fd0c1 list.h
33
1029c2784b4cae3909190c64f53a06cba12ea38e scripts/check-commitlog.sh

0 commit comments

Comments
 (0)