mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-06-03 11:12:27 +00:00
Clean up more code
The *NSYNC linked list API is good enough that it deserves to be part of the C libray, so this change writes an improved version of it which uses that offsetof() trick from the Linux Kernel. We vendor all of the *NSYNC tests in third_party which helped confirm the needed refactoring is safe This change also deletes more old code that didn't pan out. My goal here is to work towards a vision where the Cosmopolitan core libraries become less experimental and more focused on curation. This better reflects the current level of quality we've managed to achieve.
This commit is contained in:
parent
88612a2cd7
commit
0a24b4fc3c
268 changed files with 632 additions and 8688 deletions
8
third_party/nsync/testing/cv_test.c
vendored
8
third_party/nsync/testing/cv_test.c
vendored
|
@ -15,12 +15,12 @@
|
|||
│ See the License for the specific language governing permissions and │
|
||||
│ limitations under the License. │
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "third_party/nsync/cv.h"
|
||||
#include "libc/errno.h"
|
||||
#include "libc/fmt/fmt.h"
|
||||
#include "libc/mem/mem.h"
|
||||
#include "libc/runtime/runtime.h"
|
||||
#include "libc/str/str.h"
|
||||
#include "third_party/nsync/cv.h"
|
||||
#include "third_party/nsync/debug.h"
|
||||
#include "third_party/nsync/mu.h"
|
||||
#include "third_party/nsync/mu_wait.h"
|
||||
|
@ -51,7 +51,7 @@ static cv_queue *cv_queue_new (int limit) {
|
|||
cv_queue *q;
|
||||
int size = offsetof (struct cv_queue_s, data) + sizeof (q->data[0]) * limit;
|
||||
q = (cv_queue *) malloc (size);
|
||||
memset ((void *) q, 0, size);
|
||||
bzero ((void *) q, size);
|
||||
q->limit = limit;
|
||||
return (q);
|
||||
}
|
||||
|
@ -481,7 +481,7 @@ static void test_cv_debug (testing t) {
|
|||
int buflen;
|
||||
struct debug_state xs;
|
||||
struct debug_state *s = &xs;
|
||||
memset ((void *) s, 0, sizeof (*s));
|
||||
bzero ((void *) s, sizeof (*s));
|
||||
|
||||
/* Use nsync_*_debugger to check that they work. */
|
||||
tmp = nsync_mu_debugger (&s->mu);
|
||||
|
@ -708,7 +708,7 @@ static void test_cv_transfer (testing t) {
|
|||
TEST_LOG (t, ("transfer waiters %d wakeup_type %d cv_writers %d ccs_reader %d\n",
|
||||
waiters, wakeup_type, cv_writers, ccs_reader));
|
||||
}
|
||||
memset ((void *) cvt, 0, sizeof (*cvt));
|
||||
bzero ((void *) cvt, sizeof (*cvt));
|
||||
|
||||
/* Start the waiter threads that use condition variables. */
|
||||
for (i = 0; i < waiters-1; i++) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue