Skip to content

Commit

Permalink
[cage] unconst IO_VTABLE * vtables, -Wcast-qual cannot be suppressed
Browse files Browse the repository at this point in the history
  • Loading branch information
Reini Urban committed Oct 26, 2014
1 parent 153cd72 commit fa1e4fe
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
10 changes: 5 additions & 5 deletions src/io/api.c
Expand Up @@ -108,8 +108,8 @@ io_setup_vtables(PARROT_INTERP)
{
ASSERT_ARGS(io_setup_vtables)
const int number_of_vtables = 5;
interp->piodata->vtables = (const IO_VTABLE*)mem_gc_allocate_n_zeroed_typed(interp,
number_of_vtables, const IO_VTABLE);
interp->piodata->vtables = (IO_VTABLE*)mem_gc_allocate_n_zeroed_typed(interp,
number_of_vtables, IO_VTABLE);
interp->piodata->num_vtables = number_of_vtables;
io_filehandle_setup_vtable(interp, NULL, IO_VTABLE_FILEHANDLE);
io_socket_setup_vtable(interp, NULL, IO_VTABLE_SOCKET);
Expand Down Expand Up @@ -145,13 +145,13 @@ Parrot_io_allocate_new_vtable(PARROT_INTERP, ARGIN(const char *name))
const int number_of_vtables = interp->piodata->num_vtables;
IO_VTABLE *vtable;
interp->piodata->vtables = mem_gc_realloc_n_typed(interp,
(void *)interp->piodata->vtables,
number_of_vtables + 1, const IO_VTABLE);
interp->piodata->vtables,
number_of_vtables + 1, IO_VTABLE);
vtable = IO_EDITABLE_IO_VTABLE(interp, number_of_vtables);
vtable->name = name;
vtable->number = number_of_vtables;
interp->piodata->num_vtables++;
return (const IO_VTABLE *)vtable;
return vtable;
}

PARROT_WARN_UNUSED_RESULT
Expand Down
6 changes: 3 additions & 3 deletions src/io/io_private.h
Expand Up @@ -124,7 +124,7 @@ DIAGRAM
struct _ParrotIOData {
PMC ** table; /* Standard IO Streams (STDIN, STDOUT, STDERR) */
INTVAL num_vtables; /* Number of vtables */
const IO_VTABLE * vtables; /* Array of VTABLES */
IO_VTABLE * vtables; /* Array of VTABLES */
};

/* redefine PIO_STD* for internal use */
Expand Down Expand Up @@ -168,8 +168,8 @@ struct _ParrotIOData {
} while (0);

/* Get an editable version of the IO_VTABLE structure, typically used during
vtable initialization. cast the const away. */
#define IO_EDITABLE_IO_VTABLE(i, idx) (IO_VTABLE *)(&((i)->piodata->vtables[(idx)]))
vtable initialization. */
#define IO_EDITABLE_IO_VTABLE(i, idx) &((i)->piodata->vtables[(idx)])


/* HEADERIZER BEGIN: src/io/utilities.c */
Expand Down

0 comments on commit fa1e4fe

Please sign in to comment.