readapt 0.8.0 → 0.8.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/.travis.yml +4 -0
- data/CHANGELOG.md +3 -0
- data/ext/readapt/stack.c +6 -6
- data/ext/readapt/stack.h +7 -7
- data/ext/readapt/threads.h +1 -1
- data/lib/readapt/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3a783dd879a972485872f13d31e299c02b223a3bea89c3be764f9b21448a5fd7
|
4
|
+
data.tar.gz: 52776a0cfc2befe9215b2da2f828c9d82f7c8858fcad29ff4c052aef4fc70cc5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: be0687dddd12bcee0d2529262f3bae3f859da3c3d17fe3fdebd1b3631f47cd51ad2b09493ea1f6172af74dae41c0eae4ee91918d5eb89da7314620271ada51b5
|
7
|
+
data.tar.gz: 5152ece20452deea044bd6864e7f8092d2cb0c9d39bc8d89e15c3f5c9782cf67d35db9c5ca3f5cd81496724c839dd3d2dc98a2efde32258ca094c9a59c57de21
|
data/.gitignore
CHANGED
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
data/ext/readapt/stack.c
CHANGED
@@ -8,9 +8,9 @@
|
|
8
8
|
* e.g., `sizeof(some_struct)`. The optional `free_func` argument is a pointer
|
9
9
|
* to a function that will be called when an element is popped off the stack.
|
10
10
|
*/
|
11
|
-
|
11
|
+
readapt_stack_t *stack_alloc(size_t elem_size, void (*free_func)(void *))
|
12
12
|
{
|
13
|
-
|
13
|
+
readapt_stack_t *s = malloc(sizeof(readapt_stack_t));
|
14
14
|
s->elem_size = elem_size;
|
15
15
|
s->free_func = free_func;
|
16
16
|
s->size = 0;
|
@@ -21,7 +21,7 @@ stack_t *stack_alloc(size_t elem_size, void (*free_func)(void *))
|
|
21
21
|
/**
|
22
22
|
* Add an element to the end of the stack
|
23
23
|
*/
|
24
|
-
void stack_push(
|
24
|
+
void stack_push(readapt_stack_t *stack, void *element)
|
25
25
|
{
|
26
26
|
if (stack->size == stack->capacity)
|
27
27
|
{
|
@@ -43,7 +43,7 @@ void stack_push(stack_t *stack, void *element)
|
|
43
43
|
/**
|
44
44
|
* Get a pointer to the last element in the stack.
|
45
45
|
*/
|
46
|
-
void *stack_peek(
|
46
|
+
void *stack_peek(readapt_stack_t *stack)
|
47
47
|
{
|
48
48
|
return stack->size == 0 ? NULL : stack->elements[stack->size - 1];
|
49
49
|
}
|
@@ -51,7 +51,7 @@ void *stack_peek(stack_t *stack)
|
|
51
51
|
/**
|
52
52
|
* Pop the last element off the stack and pass it to free_func.
|
53
53
|
*/
|
54
|
-
void stack_pop(
|
54
|
+
void stack_pop(readapt_stack_t *stack)
|
55
55
|
{
|
56
56
|
void *e;
|
57
57
|
|
@@ -71,7 +71,7 @@ void stack_pop(stack_t *stack)
|
|
71
71
|
* Free the stack from memory. If it still contains any elements, pass them to
|
72
72
|
* free_func.
|
73
73
|
*/
|
74
|
-
void stack_free(
|
74
|
+
void stack_free(readapt_stack_t *stack)
|
75
75
|
{
|
76
76
|
int i;
|
77
77
|
|
data/ext/readapt/stack.h
CHANGED
@@ -3,18 +3,18 @@
|
|
3
3
|
|
4
4
|
#include "stddef.h"
|
5
5
|
|
6
|
-
typedef struct
|
6
|
+
typedef struct readapt_stack_struct {
|
7
7
|
int size;
|
8
8
|
size_t elem_size;
|
9
9
|
void (*free_func)(void *);
|
10
10
|
int capacity;
|
11
11
|
void **elements;
|
12
|
-
}
|
12
|
+
} readapt_stack_t;
|
13
13
|
|
14
|
-
|
15
|
-
void stack_push(
|
16
|
-
void *stack_peek(
|
17
|
-
void stack_pop(
|
18
|
-
void stack_free(
|
14
|
+
readapt_stack_t *stack_alloc(size_t elem_size, void(*free_func)(void*));
|
15
|
+
void stack_push(readapt_stack_t *stack, void *element);
|
16
|
+
void *stack_peek(readapt_stack_t *stack);
|
17
|
+
void stack_pop(readapt_stack_t *stack);
|
18
|
+
void stack_free(readapt_stack_t *stack);
|
19
19
|
|
20
20
|
#endif
|
data/ext/readapt/threads.h
CHANGED
data/lib/readapt/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: readapt
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
4
|
+
version: 0.8.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Fred Snyder
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-11-
|
11
|
+
date: 2019-11-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: backport
|