mirror of
https://github.com/claunia/flac.git
synced 2025-12-16 18:54:26 +00:00
Fix building when configured with --disable-shared.
The problem was that the function safe_malloc_mul_2op_() was originally defined as static inline in inclide/share/alloc.h but had to be moved because GCC was refusing to inline it. Once moved however, static linking would fail when building the flac executable because the function ended up beiong linked twice.
This commit is contained in:
@@ -37,10 +37,14 @@
|
||||
#include <string.h>
|
||||
|
||||
#include "private/metadata.h"
|
||||
#include "private/memory.h"
|
||||
|
||||
#include "FLAC/assert.h"
|
||||
#include "share/alloc.h"
|
||||
|
||||
/* Alias the first (in share/alloc.h) to the second (in src/libFLAC/memory.c). */
|
||||
#define safe_malloc_mul_2op_ safe_malloc_mul_2op_p
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
*
|
||||
@@ -151,7 +155,7 @@ static FLAC__bool copy_track_(FLAC__StreamMetadata_CueSheet_Track *to, const FLA
|
||||
else {
|
||||
FLAC__StreamMetadata_CueSheet_Index *x;
|
||||
FLAC__ASSERT(from->num_indices > 0);
|
||||
if(0 == (x = safe_malloc_mul_2op_(from->num_indices, /*times*/sizeof(FLAC__StreamMetadata_CueSheet_Index))))
|
||||
if(0 == (x = safe_malloc_mul_2op_p(from->num_indices, /*times*/sizeof(FLAC__StreamMetadata_CueSheet_Index))))
|
||||
return false;
|
||||
memcpy(x, from->indices, from->num_indices * sizeof(FLAC__StreamMetadata_CueSheet_Index));
|
||||
to->indices = x;
|
||||
@@ -173,7 +177,7 @@ static FLAC__StreamMetadata_SeekPoint *seekpoint_array_new_(unsigned num_points)
|
||||
|
||||
FLAC__ASSERT(num_points > 0);
|
||||
|
||||
object_array = safe_malloc_mul_2op_(num_points, /*times*/sizeof(FLAC__StreamMetadata_SeekPoint));
|
||||
object_array = safe_malloc_mul_2op_p(num_points, /*times*/sizeof(FLAC__StreamMetadata_SeekPoint));
|
||||
|
||||
if(0 != object_array) {
|
||||
unsigned i;
|
||||
|
||||
Reference in New Issue
Block a user