/*
* Copyright © 2020 Contrast Security, Inc.
* See https://www.contrastsecurity.com/enduser-terms-0317a for more details.
*/
/* THIS FILE WAS AUTOMATICALLY GENERATED BY HOOKSPY */
/* Python requires its own header to always be included first */
#define PY_SSIZE_T_CLEAN
#include <Python.h>

#include <contrast/assess/propagate.h>
#include <contrast/assess/scope.h>
#include <contrast/assess/utils.h>

typedef PyObject *(*fastcall_func)(PyObject *, PyObject *const *, Py_ssize_t);
typedef PyObject *(*fastcall_kwargs_func)(PyObject *, PyObject *const *, Py_ssize_t, PyObject *);

#define IOBASE_READLINE_OFFSET 16
#define IOBASE_READLINES_OFFSET 17


fastcall_func iobase_readline_orig;
fastcall_func iobase_readlines_orig;


HOOK_STREAM_FASTCALL(iobase_readline, "readline");
HOOK_STREAM_FASTCALL(iobase_readlines, "readlines");



int patch_iobase_methods(funchook_t *funchook, PyTypeObject *StreamType) {

    ADD_STREAM_HOOK(StreamType, iobase_readline, IOBASE_READLINE_OFFSET);
    ADD_STREAM_HOOK(StreamType, iobase_readlines, IOBASE_READLINES_OFFSET);

    /* Indicates success */
    return 0;
}

