Skip to content

Commit 1c47411

Browse files
committed
fixed copy&paste errors
1 parent c76d3ee commit 1c47411

File tree

4 files changed

+63
-65
lines changed

4 files changed

+63
-65
lines changed

src/async_defines.h

+34-34
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,38 @@
1-
#ifndef LJACK_ASYNC_DEFINES_H
2-
#define LJACK_ASYNC_DEFINES_H
1+
#ifndef CARRAY_ASYNC_DEFINES_H
2+
#define CARRAY_ASYNC_DEFINES_H
33

44
/* -------------------------------------------------------------------------------------------- */
55

6-
#if defined(LJACK_ASYNC_USE_WIN32) \
7-
&& ( defined(LJACK_ASYNC_USE_STDATOMIC) \
8-
|| defined(LJACK_ASYNC_USE_GNU))
9-
#error "LJACK_ASYNC: Invalid compile flag combination"
6+
#if defined(CARRAY_ASYNC_USE_WIN32) \
7+
&& ( defined(CARRAY_ASYNC_USE_STDATOMIC) \
8+
|| defined(CARRAY_ASYNC_USE_GNU))
9+
#error "CARRAY_ASYNC: Invalid compile flag combination"
1010
#endif
11-
#if defined(LJACK_ASYNC_USE_STDATOMIC) \
12-
&& ( defined(LJACK_ASYNC_USE_WIN32) \
13-
|| defined(LJACK_ASYNC_USE_GNU))
14-
#error "LJACK_ASYNC: Invalid compile flag combination"
11+
#if defined(CARRAY_ASYNC_USE_STDATOMIC) \
12+
&& ( defined(CARRAY_ASYNC_USE_WIN32) \
13+
|| defined(CARRAY_ASYNC_USE_GNU))
14+
#error "CARRAY_ASYNC: Invalid compile flag combination"
1515
#endif
16-
#if defined(LJACK_ASYNC_USE_GNU) \
17-
&& ( defined(LJACK_ASYNC_USE_WIN32) \
18-
|| defined(LJACK_ASYNC_USE_STDATOMIC))
19-
#error "LJACK_ASYNC: Invalid compile flag combination"
16+
#if defined(CARRAY_ASYNC_USE_GNU) \
17+
&& ( defined(CARRAY_ASYNC_USE_WIN32) \
18+
|| defined(CARRAY_ASYNC_USE_STDATOMIC))
19+
#error "CARRAY_ASYNC: Invalid compile flag combination"
2020
#endif
2121

2222
/* -------------------------------------------------------------------------------------------- */
2323

24-
#if !defined(LJACK_ASYNC_USE_WIN32) \
25-
&& !defined(LJACK_ASYNC_USE_STDATOMIC) \
26-
&& !defined(LJACK_ASYNC_USE_GNU)
24+
#if !defined(CARRAY_ASYNC_USE_WIN32) \
25+
&& !defined(CARRAY_ASYNC_USE_STDATOMIC) \
26+
&& !defined(CARRAY_ASYNC_USE_GNU)
2727

2828
#if defined(WIN32) || defined(_WIN32)
29-
#define LJACK_ASYNC_USE_WIN32
29+
#define CARRAY_ASYNC_USE_WIN32
3030
#elif defined(__GNUC__)
31-
#define LJACK_ASYNC_USE_GNU
31+
#define CARRAY_ASYNC_USE_GNU
3232
#elif __STDC_VERSION__ >= 201112L && !defined(__STDC_NO_ATOMICS__)
33-
#define LJACK_ASYNC_USE_STDATOMIC
33+
#define CARRAY_ASYNC_USE_STDATOMIC
3434
#else
35-
#error "LJACK_ASYNC: unknown platform"
35+
#error "CARRAY_ASYNC: unknown platform"
3636
#endif
3737
#endif
3838

@@ -42,39 +42,39 @@
4242
#include <unistd.h>
4343
#endif
4444

45-
#if !defined(LJACK_ASYNC_USE_WINTHREAD) \
46-
&& !defined(LJACK_ASYNC_USE_PTHREAD) \
47-
&& !defined(LJACK_ASYNC_USE_STDTHREAD)
45+
#if !defined(CARRAY_ASYNC_USE_WINTHREAD) \
46+
&& !defined(CARRAY_ASYNC_USE_PTHREAD) \
47+
&& !defined(CARRAY_ASYNC_USE_STDTHREAD)
4848

49-
#ifdef LJACK_ASYNC_USE_WIN32
50-
#define LJACK_ASYNC_USE_WINTHREAD
49+
#ifdef CARRAY_ASYNC_USE_WIN32
50+
#define CARRAY_ASYNC_USE_WINTHREAD
5151
#elif _XOPEN_VERSION >= 600
52-
#define LJACK_ASYNC_USE_PTHREAD
52+
#define CARRAY_ASYNC_USE_PTHREAD
5353
#elif __STDC_VERSION__ >= 201112L && !defined(__STDC_NO_THREADS__)
54-
#define LJACK_ASYNC_USE_STDTHREAD
54+
#define CARRAY_ASYNC_USE_STDTHREAD
5555
#else
56-
#define LJACK_ASYNC_USE_PTHREAD
56+
#define CARRAY_ASYNC_USE_PTHREAD
5757
#endif
5858
#endif
5959

6060
/* -------------------------------------------------------------------------------------------- */
6161

62-
#if defined(LJACK_ASYNC_USE_PTHREAD)
62+
#if defined(CARRAY_ASYNC_USE_PTHREAD)
6363
#ifndef _XOPEN_SOURCE
6464
#define _XOPEN_SOURCE 600 /* must be defined before any other include */
6565
#endif
6666
#include <errno.h>
6767
#include <sys/time.h>
6868
#include <pthread.h>
6969
#endif
70-
#if defined(LJACK_ASYNC_USE_WIN32) || defined(LJACK_ASYNC_USE_WINTHREAD)
70+
#if defined(CARRAY_ASYNC_USE_WIN32) || defined(CARRAY_ASYNC_USE_WINTHREAD)
7171
#include <windows.h>
7272
#endif
73-
#if defined(LJACK_ASYNC_USE_STDATOMIC)
73+
#if defined(CARRAY_ASYNC_USE_STDATOMIC)
7474
#include <stdint.h>
7575
#include <stdatomic.h>
7676
#endif
77-
#if defined(LJACK_ASYNC_USE_STDTHREAD)
77+
#if defined(CARRAY_ASYNC_USE_STDTHREAD)
7878
#include <sys/time.h>
7979
#include <threads.h>
8080
#endif
@@ -95,4 +95,4 @@
9595
/* -------------------------------------------------------------------------------------------- */
9696

9797

98-
#endif /* LJACK_ASYNC_DEFINES_H */
98+
#endif /* CARRAY_ASYNC_DEFINES_H */

src/async_util.h

+28-28
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
11
#include "util.h"
22

3-
#ifndef LJACK_ASYNC_UTIL_H
4-
#define LJACK_ASYNC_UTIL_H
3+
#ifndef CARRAY_ASYNC_UTIL_H
4+
#define CARRAY_ASYNC_UTIL_H
55

66
/* -------------------------------------------------------------------------------------------- */
77

8-
#define async_util_abort ljack_async_util_abort
8+
#define async_util_abort carray_async_util_abort
99
bool async_util_abort(int rc, int line); /* function does not return */
1010

1111
/* -------------------------------------------------------------------------------------------- */
1212

13-
#if defined(LJACK_ASYNC_USE_WIN32)
13+
#if defined(CARRAY_ASYNC_USE_WIN32)
1414
typedef LONG AtomicCounter;
1515
typedef PVOID AtomicPtr;
16-
#elif defined(LJACK_ASYNC_USE_STDATOMIC)
16+
#elif defined(CARRAY_ASYNC_USE_STDATOMIC)
1717
typedef atomic_int AtomicCounter;
1818
typedef atomic_intptr_t AtomicPtr;
19-
#elif defined(LJACK_ASYNC_USE_GNU)
19+
#elif defined(CARRAY_ASYNC_USE_GNU)
2020
typedef int AtomicCounter;
2121
typedef void* AtomicPtr;
2222
#endif
@@ -25,23 +25,23 @@ typedef void* AtomicPtr;
2525

2626
static inline bool atomic_set_ptr_if_equal(AtomicPtr* ptr, void* oldPtr, void* newPtr)
2727
{
28-
#if defined(LJACK_ASYNC_USE_WIN32)
28+
#if defined(CARRAY_ASYNC_USE_WIN32)
2929
return oldPtr == InterlockedCompareExchangePointer(ptr, newPtr, oldPtr);
30-
#elif defined(LJACK_ASYNC_USE_STDATOMIC)
30+
#elif defined(CARRAY_ASYNC_USE_STDATOMIC)
3131
intptr_t old = (intptr_t) oldPtr;
3232
return atomic_compare_exchange_strong(ptr, &old, (intptr_t)newPtr);
33-
#elif defined(LJACK_ASYNC_USE_GNU)
33+
#elif defined(CARRAY_ASYNC_USE_GNU)
3434
return __sync_bool_compare_and_swap(ptr, oldPtr, newPtr);
3535
#endif
3636
}
3737

3838
static inline void* atomic_get_ptr(AtomicPtr* ptr)
3939
{
40-
#if defined(LJACK_ASYNC_USE_WIN32)
40+
#if defined(CARRAY_ASYNC_USE_WIN32)
4141
return InterlockedCompareExchangePointer(ptr, 0, 0);
42-
#elif defined(LJACK_ASYNC_USE_STDATOMIC)
42+
#elif defined(CARRAY_ASYNC_USE_STDATOMIC)
4343
return (void*)atomic_load(ptr);
44-
#elif defined(LJACK_ASYNC_USE_GNU)
44+
#elif defined(CARRAY_ASYNC_USE_GNU)
4545
return __sync_add_and_fetch(ptr, 0);
4646
#endif
4747
}
@@ -50,55 +50,55 @@ static inline void* atomic_get_ptr(AtomicPtr* ptr)
5050

5151
static inline int atomic_inc(AtomicCounter* value)
5252
{
53-
#if defined(LJACK_ASYNC_USE_WIN32)
53+
#if defined(CARRAY_ASYNC_USE_WIN32)
5454
return InterlockedIncrement(value);
55-
#elif defined(LJACK_ASYNC_USE_STDATOMIC)
55+
#elif defined(CARRAY_ASYNC_USE_STDATOMIC)
5656
return atomic_fetch_add(value, 1) + 1;
57-
#elif defined(LJACK_ASYNC_USE_GNU)
57+
#elif defined(CARRAY_ASYNC_USE_GNU)
5858
return __sync_add_and_fetch(value, 1);
5959
#endif
6060
}
6161

6262
static inline int atomic_dec(AtomicCounter* value)
6363
{
64-
#if defined(LJACK_ASYNC_USE_WIN32)
64+
#if defined(CARRAY_ASYNC_USE_WIN32)
6565
return InterlockedDecrement(value);
66-
#elif defined(LJACK_ASYNC_USE_STDATOMIC)
66+
#elif defined(CARRAY_ASYNC_USE_STDATOMIC)
6767
return atomic_fetch_sub(value, 1) - 1;
68-
#elif defined(LJACK_ASYNC_USE_GNU)
68+
#elif defined(CARRAY_ASYNC_USE_GNU)
6969
return __sync_sub_and_fetch(value, 1);
7070
#endif
7171
}
7272

7373
static inline bool atomic_set_if_equal(AtomicCounter* value, int oldValue, int newValue)
7474
{
75-
#if defined(LJACK_ASYNC_USE_WIN32)
75+
#if defined(CARRAY_ASYNC_USE_WIN32)
7676
return oldValue == InterlockedCompareExchange(value, newValue, oldValue);
77-
#elif defined(LJACK_ASYNC_USE_STDATOMIC)
77+
#elif defined(CARRAY_ASYNC_USE_STDATOMIC)
7878
return atomic_compare_exchange_strong(value, &oldValue, newValue);
79-
#elif defined(LJACK_ASYNC_USE_GNU)
79+
#elif defined(CARRAY_ASYNC_USE_GNU)
8080
return __sync_bool_compare_and_swap(value, oldValue, newValue);
8181
#endif
8282
}
8383

8484
static inline int atomic_get(AtomicCounter* value)
8585
{
86-
#if defined(LJACK_ASYNC_USE_WIN32)
86+
#if defined(CARRAY_ASYNC_USE_WIN32)
8787
return InterlockedCompareExchange(value, 0, 0);
88-
#elif defined(LJACK_ASYNC_USE_STDATOMIC)
88+
#elif defined(CARRAY_ASYNC_USE_STDATOMIC)
8989
return atomic_load(value);
90-
#elif defined(LJACK_ASYNC_USE_GNU)
90+
#elif defined(CARRAY_ASYNC_USE_GNU)
9191
return __sync_add_and_fetch(value, 0);
9292
#endif
9393
}
9494

9595
static inline int atomic_set(AtomicCounter* value, int newValue)
9696
{
97-
#if defined(LJACK_ASYNC_USE_WIN32)
97+
#if defined(CARRAY_ASYNC_USE_WIN32)
9898
return InterlockedExchange(value, newValue);
99-
#elif defined(LJACK_ASYNC_USE_STDATOMIC)
99+
#elif defined(CARRAY_ASYNC_USE_STDATOMIC)
100100
return atomic_exchange(value, newValue);
101-
#elif defined(LJACK_ASYNC_USE_GNU)
101+
#elif defined(CARRAY_ASYNC_USE_GNU)
102102
int rslt = __sync_lock_test_and_set(value, newValue);
103103
__sync_synchronize();
104104
return rslt;
@@ -107,5 +107,5 @@ static inline int atomic_set(AtomicCounter* value, int newValue)
107107

108108
/* -------------------------------------------------------------------------------------------- */
109109

110-
#endif /* LJACK_ASYNC_UTIL_H */
110+
#endif /* CARRAY_ASYNC_UTIL_H */
111111

src/carray_capi_impl.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ static carray* internalNewCarray(lua_State* L, carray_type type, carray_attr att
2323
case CARRAY_UCHAR: isInteger = true; elementSize = sizeof(unsigned char); isUnsigned = true; break;
2424

2525
case CARRAY_SHORT: isInteger = true; elementSize = sizeof(short); break;
26-
case CARRAY_USHORT: isInteger = true; elementSize = sizeof(ushort); isUnsigned = true; break;
26+
case CARRAY_USHORT: isInteger = true; elementSize = sizeof(unsigned short); isUnsigned = true; break;
2727

2828
case CARRAY_INT: isInteger = true; elementSize = sizeof(int); break;
2929
case CARRAY_UINT: isInteger = true; elementSize = sizeof(unsigned int); isUnsigned = true; break;

src/main.c

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
#include <jack/jack.h>
2-
31
#define CARRAY_CAPI_IMPLEMENT_SET_CAPI 1
42

53
#include "util.h"

0 commit comments

Comments
 (0)