cmultibyte 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +6 -2
- data/ext/cmultibyte.c +1 -2
- data/lib/cmultibyte/version.rb +1 -1
- metadata +1 -1
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# Cmultibyte
|
2
2
|
|
3
|
-
|
3
|
+
This reimplements `ActiveSupport::Multibyte::Unicode.tidy_bytes` in C.
|
4
4
|
|
5
5
|
## Installation
|
6
6
|
|
@@ -18,7 +18,7 @@ Or install it yourself as:
|
|
18
18
|
|
19
19
|
## Usage
|
20
20
|
|
21
|
-
|
21
|
+
Just require it. It monkeypatches AS.
|
22
22
|
|
23
23
|
## Contributing
|
24
24
|
|
@@ -27,3 +27,7 @@ TODO: Write usage instructions here
|
|
27
27
|
3. Commit your changes (`git commit -am 'Add some feature'`)
|
28
28
|
4. Push to the branch (`git push origin my-new-feature`)
|
29
29
|
5. Create new Pull Request
|
30
|
+
|
31
|
+
To run the tests, cd into the activesupport source and run:
|
32
|
+
|
33
|
+
`cd /path/to/cmultibyte/ext ; make ; cd - ; bundle exec ruby -I./test -I./lib -r/path/to/cmultibyte/ext/cmultibyte.bundle test/multibyte_*`
|
data/ext/cmultibyte.c
CHANGED
@@ -92,7 +92,7 @@ static VALUE tidy_bytes(VALUE string) {
|
|
92
92
|
int i, j;
|
93
93
|
uint8_t byte;
|
94
94
|
|
95
|
-
uint8_t *arr =
|
95
|
+
uint8_t *arr = ALLOCA_N(uint8_t, 4 * RSTRING_LEN(string));
|
96
96
|
uint8_t *curr = arr;
|
97
97
|
uint8_t *prev = curr;
|
98
98
|
uint8_t *last_lead = curr;
|
@@ -155,7 +155,6 @@ static VALUE tidy_bytes(VALUE string) {
|
|
155
155
|
}
|
156
156
|
}
|
157
157
|
VALUE str = rb_str_new((const char *)arr, curr-arr);
|
158
|
-
free(arr);
|
159
158
|
return str;
|
160
159
|
}
|
161
160
|
|
data/lib/cmultibyte/version.rb
CHANGED