supplement 2.24 → 2.26
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README +1 -1
- data/lib/mkrf_conf +1 -0
- data/lib/supplement/filesys.c +3 -8
- data/lib/supplement.c +16 -82
- data/lib/supplement.h +0 -2
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6a901ea1ffc61c2fc508aa25ecded2cdf4668547f9dccdfa9b8cfbe7e8aea505
|
4
|
+
data.tar.gz: b156a06a97b495b524550fc903de39a7db9f007451aa6102ac50e66391a304a5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 197c7244e880680e7e9623236dc2e81bfa76f54df5708c75a73d9fd839f40bcd835b2a3e99e89e99ffbffa54386ef0c09de421e6b761937860dd8047119f58c9
|
7
|
+
data.tar.gz: a73e89d0257c48cd54916446ec507ed431e01451bb52cc29d6b50e65517b18b02c8aebd351d924c8f95588d15af8cc3e1ca4349504540150f40a922cb0a1c1f0
|
data/README
CHANGED
data/lib/mkrf_conf
CHANGED
data/lib/supplement/filesys.c
CHANGED
@@ -5,12 +5,14 @@
|
|
5
5
|
#include "filesys.h"
|
6
6
|
|
7
7
|
#include <stdlib.h>
|
8
|
-
#ifdef
|
8
|
+
#ifdef HAVE_HEADER_SYS_VFS_H
|
9
9
|
/* Linux */
|
10
10
|
#include <sys/vfs.h>
|
11
|
+
#define FSID_val __val
|
11
12
|
#else
|
12
13
|
#include <sys/param.h>
|
13
14
|
#include <sys/mount.h>
|
15
|
+
#define FSID_val val
|
14
16
|
#endif
|
15
17
|
|
16
18
|
|
@@ -209,13 +211,6 @@ rb_fsstat_ffree( VALUE self)
|
|
209
211
|
* Filesystem id; array of 2 integers.
|
210
212
|
*/
|
211
213
|
|
212
|
-
#ifdef __FSID_T_TYPE
|
213
|
-
/* Linux */
|
214
|
-
#define FSID_val __val
|
215
|
-
#else
|
216
|
-
#define FSID_val val
|
217
|
-
#endif
|
218
|
-
|
219
214
|
VALUE
|
220
215
|
rb_fsstat_fsid( VALUE self)
|
221
216
|
{
|
data/lib/supplement.c
CHANGED
@@ -17,6 +17,7 @@
|
|
17
17
|
#endif
|
18
18
|
|
19
19
|
|
20
|
+
static void supplement_ary_assure_notempty( VALUE);
|
20
21
|
static VALUE supplement_index_blk( VALUE);
|
21
22
|
static VALUE supplement_index_ref( VALUE, VALUE);
|
22
23
|
static VALUE supplement_rindex_blk( VALUE);
|
@@ -621,78 +622,6 @@ rb_str_axe( int argc, VALUE *argv, VALUE str)
|
|
621
622
|
* Document-class: Numeric
|
622
623
|
*/
|
623
624
|
|
624
|
-
/*
|
625
|
-
* call-seq:
|
626
|
-
* pos? -> true or false
|
627
|
-
*
|
628
|
-
* Check whether +num+ is positive.
|
629
|
-
*
|
630
|
-
*/
|
631
|
-
|
632
|
-
VALUE
|
633
|
-
rb_num_pos_p( VALUE num)
|
634
|
-
{
|
635
|
-
VALUE r = Qfalse;
|
636
|
-
|
637
|
-
switch (TYPE( num)) {
|
638
|
-
case T_FIXNUM:
|
639
|
-
if (NUM2LONG( num) > 0)
|
640
|
-
r = Qtrue;
|
641
|
-
break;
|
642
|
-
|
643
|
-
case T_BIGNUM:
|
644
|
-
if (RBIGNUM_SIGN( num)) /* 0 is not a Bignum. */
|
645
|
-
r = Qtrue;
|
646
|
-
break;
|
647
|
-
|
648
|
-
case T_FLOAT:
|
649
|
-
if (RFLOAT_VALUE( num) > 0.0)
|
650
|
-
r = Qtrue;
|
651
|
-
break;
|
652
|
-
|
653
|
-
default:
|
654
|
-
return rb_num_neg_p( rb_funcall( INT2FIX( 0), id_cmp, 1, num));
|
655
|
-
break;
|
656
|
-
}
|
657
|
-
return r;
|
658
|
-
}
|
659
|
-
|
660
|
-
/*
|
661
|
-
* call-seq:
|
662
|
-
* neg? -> true or false
|
663
|
-
*
|
664
|
-
* Check whether +num+ is negative.
|
665
|
-
*
|
666
|
-
*/
|
667
|
-
|
668
|
-
VALUE
|
669
|
-
rb_num_neg_p( VALUE num)
|
670
|
-
{
|
671
|
-
VALUE r = Qfalse;
|
672
|
-
|
673
|
-
switch (TYPE( num)) {
|
674
|
-
case T_FIXNUM:
|
675
|
-
if (NUM2LONG( num) < 0)
|
676
|
-
r = Qtrue;
|
677
|
-
break;
|
678
|
-
|
679
|
-
case T_BIGNUM:
|
680
|
-
if (!RBIGNUM_SIGN( num)) /* 0 is not a Bignum. */
|
681
|
-
r = Qtrue;
|
682
|
-
break;
|
683
|
-
|
684
|
-
case T_FLOAT:
|
685
|
-
if (RFLOAT_VALUE( num) < 0.0)
|
686
|
-
r = Qtrue;
|
687
|
-
break;
|
688
|
-
|
689
|
-
default:
|
690
|
-
return rb_num_neg_p( rb_funcall( num, id_cmp, 1, INT2FIX( 0)));
|
691
|
-
break;
|
692
|
-
}
|
693
|
-
return r;
|
694
|
-
}
|
695
|
-
|
696
625
|
/*
|
697
626
|
* call-seq:
|
698
627
|
* grammatical sing, plu -> str
|
@@ -832,18 +761,27 @@ VALUE
|
|
832
761
|
rb_ary_first_set( VALUE ary, VALUE val)
|
833
762
|
{
|
834
763
|
rb_ary_modify( ary);
|
835
|
-
|
836
|
-
if (len == 0)
|
837
|
-
rb_raise( rb_eArgError, "cannot replace first element of an empty array");
|
764
|
+
supplement_ary_assure_notempty( ary);
|
838
765
|
RARRAY_ASET( ary, 0, val);
|
839
766
|
return val;
|
840
767
|
}
|
841
768
|
|
769
|
+
void
|
770
|
+
supplement_ary_assure_notempty( VALUE ary)
|
771
|
+
{
|
772
|
+
long len = RARRAY_LEN( ary);
|
773
|
+
if (len == 0) {
|
774
|
+
VALUE q = Qnil;
|
775
|
+
rb_ary_cat( ary, &q, 1);
|
776
|
+
}
|
777
|
+
}
|
778
|
+
|
842
779
|
/*
|
843
780
|
* call-seq:
|
844
781
|
* last = obj -> obj
|
845
782
|
*
|
846
|
-
* Replace the last element.
|
783
|
+
* Replace the last element. Almost equivalent to
|
784
|
+
* <code>ary[-1]=</code> (works also for empty arrays).
|
847
785
|
*
|
848
786
|
* a = [ 42, 39, -1]
|
849
787
|
* a.last = 42
|
@@ -857,10 +795,8 @@ VALUE
|
|
857
795
|
rb_ary_last_set( VALUE ary, VALUE val)
|
858
796
|
{
|
859
797
|
rb_ary_modify( ary);
|
860
|
-
|
861
|
-
|
862
|
-
rb_raise( rb_eArgError, "cannot replace last element of an empty array");
|
863
|
-
RARRAY_ASET( ary, len - 1, val);
|
798
|
+
supplement_ary_assure_notempty( ary);
|
799
|
+
RARRAY_ASET( ary, RARRAY_LEN( ary) - 1, val);
|
864
800
|
return val;
|
865
801
|
}
|
866
802
|
|
@@ -1492,8 +1428,6 @@ void Init_supplement( void)
|
|
1492
1428
|
#endif
|
1493
1429
|
rb_define_method( rb_cString, "axe", rb_str_axe, -1);
|
1494
1430
|
|
1495
|
-
rb_define_method( rb_cNumeric, "pos?", rb_num_pos_p, 0);
|
1496
|
-
rb_define_method( rb_cNumeric, "neg?", rb_num_neg_p, 0);
|
1497
1431
|
rb_define_method( rb_cNumeric, "grammatical", rb_num_grammatical, 2);
|
1498
1432
|
rb_define_method( rb_cNumeric, "sqrt", rb_num_sqrt, 0);
|
1499
1433
|
rb_define_method( rb_cNumeric, "cbrt", rb_num_cbrt, 0);
|
data/lib/supplement.h
CHANGED
@@ -43,8 +43,6 @@ extern VALUE rb_str_ord( VALUE);
|
|
43
43
|
#endif
|
44
44
|
extern VALUE rb_str_axe( int, VALUE *, VALUE);
|
45
45
|
|
46
|
-
extern VALUE rb_num_pos_p( VALUE);
|
47
|
-
extern VALUE rb_num_neg_p( VALUE);
|
48
46
|
extern VALUE rb_num_grammatical( VALUE, VALUE, VALUE);
|
49
47
|
extern VALUE rb_num_sqrt( VALUE);
|
50
48
|
extern VALUE rb_num_cbrt( VALUE);
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: supplement
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '2.
|
4
|
+
version: '2.26'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bertram Scharpf
|
8
8
|
bindir: bin
|
9
9
|
cert_chain: []
|
10
|
-
date:
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
11
11
|
dependencies:
|
12
12
|
- !ruby/object:Gem::Dependency
|
13
13
|
name: rake
|
@@ -45,8 +45,8 @@ executables: []
|
|
45
45
|
extensions:
|
46
46
|
- lib/mkrf_conf
|
47
47
|
extra_rdoc_files:
|
48
|
-
- README
|
49
48
|
- LICENSE
|
49
|
+
- README
|
50
50
|
files:
|
51
51
|
- LICENSE
|
52
52
|
- README
|
@@ -91,7 +91,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
91
91
|
version: '0'
|
92
92
|
requirements:
|
93
93
|
- Ruby and the autorake gem
|
94
|
-
rubygems_version: 3.6.
|
94
|
+
rubygems_version: 3.6.7
|
95
95
|
specification_version: 4
|
96
96
|
summary: Simple Ruby extensions
|
97
97
|
test_files: []
|