Permalink
Browse files

removed stpncpy

  • Loading branch information...
ohler55 committed Oct 17, 2013
1 parent b5338fa commit fc23d0f7ef1337d9bb0503a3fb80d03e4067ae81
Showing with 15 additions and 16 deletions.
  1. +0 −14 ext/ox/sax.c
  2. +14 −1 ext/ox/sax_buf.c
  3. +1 −1 lib/ox/version.rb
View
@@ -85,20 +85,6 @@ static Nv hint_try_close(SaxDrive dr, const char *name);
VALUE ox_sax_value_class = Qnil;
-/* This is only for CentOS 5.4 with Ruby 1.9.3-p0 and for OS X 10.6 and Solaris 10. */
-#ifdef NEEDS_STPCPY
-char *stpncpy(char *dest, const char *src, size_t n) {
- size_t cnt = strlen(src) + 1;
-
- if (n < cnt) {
- cnt = n;
- }
- strncpy(dest, src, cnt);
-
- return dest + cnt - 1;
-}
-#endif
-
static VALUE protect_parse(VALUE drp) {
parse((SaxDrive)drp);
View
@@ -243,6 +243,19 @@ read_from_fd(Buf buf) {
}
#endif
+static char*
+ox_stpncpy(char *dest, const char *src, size_t n) {
+ size_t cnt = strlen(src) + 1;
+
+ if (n < cnt) {
+ cnt = n;
+ }
+ strncpy(dest, src, cnt);
+
+ return dest + cnt - 1;
+}
+
+
static int
read_from_str(Buf buf) {
size_t max = buf->end - buf->tail - 1;
@@ -253,7 +266,7 @@ read_from_str(Buf buf) {
/* done */
return -1;
}
- s = stpncpy(buf->tail, buf->in_str, max);
+ s = ox_stpncpy(buf->tail, buf->in_str, max);
*s = '\0';
cnt = s - buf->tail;
buf->in_str += cnt;
View
@@ -1,5 +1,5 @@
module Ox
# Current version of the module.
- VERSION = '2.0.11'
+ VERSION = '2.0.12a1'
end

0 comments on commit fc23d0f

Please sign in to comment.