Skip to content

Commit

Permalink
remove unused function PackFile_remove_segment_by_name
Browse files Browse the repository at this point in the history
  • Loading branch information
cotto committed Dec 31, 2010
1 parent 5089dca commit ab1f1f9
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 57 deletions.
16 changes: 0 additions & 16 deletions include/parrot/packfile.h
Expand Up @@ -741,17 +741,6 @@ PackFile * PackFile_new_dummy(PARROT_INTERP, ARGIN(STRING *name))
__attribute__nonnull__(1)
__attribute__nonnull__(2);

PARROT_EXPORT
PARROT_WARN_UNUSED_RESULT
PARROT_CAN_RETURN_NULL
PackFile_Segment * PackFile_remove_segment_by_name(PARROT_INTERP,
ARGMOD(PackFile_Directory *dir),
ARGIN(STRING *name))
__attribute__nonnull__(1)
__attribute__nonnull__(2)
__attribute__nonnull__(3)
FUNC_MODIFIES(*dir);

PARROT_EXPORT
void PackFile_Segment_destroy(PARROT_INTERP, ARGMOD(PackFile_Segment *self))
__attribute__nonnull__(1)
Expand Down Expand Up @@ -978,11 +967,6 @@ void Parrot_trace_eprintf(ARGIN(const char *s), ...)
#define ASSERT_ARGS_PackFile_new_dummy __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp) \
, PARROT_ASSERT_ARG(name))
#define ASSERT_ARGS_PackFile_remove_segment_by_name \
__attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp) \
, PARROT_ASSERT_ARG(dir) \
, PARROT_ASSERT_ARG(name))
#define ASSERT_ARGS_PackFile_Segment_destroy __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp) \
, PARROT_ASSERT_ARG(self))
Expand Down
41 changes: 0 additions & 41 deletions src/packfile/api.c
Expand Up @@ -1235,47 +1235,6 @@ PackFile_find_segment(PARROT_INTERP, ARGIN_NULLOK(PackFile_Directory *dir),
}


/*
=item C<PackFile_Segment * PackFile_remove_segment_by_name(PARROT_INTERP,
PackFile_Directory *dir, STRING *name)>
Finds, removes, and returns the segment with name C<name> in the
C<PackFile_Directory>. The caller is responsible for destroying the segment.
=cut
*/

PARROT_EXPORT
PARROT_WARN_UNUSED_RESULT
PARROT_CAN_RETURN_NULL
PackFile_Segment *
PackFile_remove_segment_by_name(PARROT_INTERP, ARGMOD(PackFile_Directory *dir),
ARGIN(STRING *name))
{
ASSERT_ARGS(PackFile_remove_segment_by_name)
size_t i;

for (i = 0; i < dir->num_segments; ++i) {
PackFile_Segment * const seg = dir->segments[i];
if (STRING_equal(interp, seg->name, name)) {
dir->num_segments--;

if (i != dir->num_segments) {
/* We're not the last segment, so we need to move things */
memmove(&dir->segments[i], &dir->segments[i+1],
(dir->num_segments - i) * sizeof (PackFile_Segment *));
}

return seg;
}
}

return NULL;
}


/*
=back
Expand Down

0 comments on commit ab1f1f9

Please sign in to comment.