File tree 1 file changed +15
-1
lines changed
1 file changed +15
-1
lines changed Original file line number Diff line number Diff line change 793
793
794
794
# concatenate byte arrays into a single array
795
795
796
- memcat () = Array {Uint8,1 }((0 ,))
796
+ memcat () = Array (Int8,0 )
797
+
798
+ function memcat (a :: Array {Uint8,1 })
799
+ b = Array(Uint8, length(a))
800
+ ccall(dlsym(libc, :memcpy), Ptr{Uint8},
801
+ (Ptr{Uint8}, Ptr{Uint8}, Ulong),
802
+ pointer (b), pointer (a), ulong (length (a)))
803
+ return b
804
+ end
797
805
798
806
function memcat (arrays :: Array {Uint8,1 }... )
799
807
n = 0
814
822
815
823
# concatenate the data fields of byte strings
816
824
825
+ memcat (s:: ByteString ) = memcat (s .data )
826
+
817
827
function memcat (strs :: ByteString ... )
818
828
n = 0
819
829
for s = strs
@@ -830,3 +840,7 @@ function memcat(strs::ByteString...)
830
840
end
831
841
data
832
842
end
843
+
844
+ # copying a byte string (generally not needed)
845
+
846
+ strcpy{T < : ByteString }(s:: T ) = T (memcat (s))
You can’t perform that action at this time.
0 commit comments