Permalink
Browse files

Remove rbstrio.c - funopen/fopencookie no longer required

  • Loading branch information...
1 parent 70493bf commit 6119fd287fcb44e002d151e538c213f52554017d @rtomayko rtomayko committed Mar 4, 2009
Showing with 0 additions and 52 deletions.
  1. +0 −48 ext/rbstrio.c
  2. +0 −4 ext/rbstrio.h
View
@@ -1,48 +0,0 @@
-#if defined(HAVE_FOPENCOOKIE)
-# define _GNU_SOURCE
-#endif
-
-#include <stdlib.h>
-#include "rbstrio.h"
-
-#define INCREMENT 1024
-
-/* called when data is written to the stream. */
-static int rb_str_io_write(void *cookie, const char *data, int len) {
- VALUE buf = (VALUE)cookie;
- rb_str_cat(buf, data, len);
- return len;
-}
-
-/* called when the stream is closed */
-static int rb_str_io_close(void *cookie) {
- VALUE buf = (VALUE)cookie;
- rb_gc_unregister_address(&buf);
- return 0;
-}
-
-#if defined(HAVE_FOPENCOOKIE)
-cookie_io_functions_t rb_str_io_functions =
-{
- (cookie_read_function_t*)NULL,
- (cookie_write_function_t*)rb_str_io_write,
- (cookie_seek_function_t*)NULL,
- (cookie_close_function_t*)rb_str_io_close
-};
-#endif
-
-/* create a stream backed by a Ruby string. */
-FILE *rb_str_io_new(VALUE buf) {
- FILE *rv;
- Check_Type(buf, T_STRING);
-#if defined(HAVE_FOPENCOOKIE)
- rv = fopencookie((void*)buf, "w", rb_str_io_functions);
-#else
- rv = funopen((void*)buf, NULL, rb_str_io_write, NULL, rb_str_io_close);
-#endif
- /* TODO if (rv == NULL) */
- rb_gc_register_address(&buf);
- return rv;
-}
-
-/* vim: set ts=4 sw=4: */
View
@@ -1,4 +0,0 @@
-#include <stdio.h>
-#include "ruby.h"
-
-FILE *rb_str_io_new(VALUE buf);

0 comments on commit 6119fd2

Please sign in to comment.