mirror of
https://github.com/raspberrypi/userland.git
synced 2025-12-06 04:49:12 +00:00
vcos: Implement vcos_strdup directly
This commit is contained in:
@@ -32,6 +32,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#include "containers/core/containers_private.h"
|
||||
#include "containers/core/containers_utils.h"
|
||||
#include "containers/core/containers_writer_utils.h"
|
||||
#include "vcos.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
@@ -77,7 +78,7 @@ VC_CONTAINER_STATUS_T vc_container_writer_extraio_create_temp(VC_CONTAINER_T *co
|
||||
VC_CONTAINER_STATUS_T vc_container_writer_extraio_delete(VC_CONTAINER_T *context, VC_CONTAINER_WRITER_EXTRAIO_T *extraio)
|
||||
{
|
||||
VC_CONTAINER_STATUS_T status;
|
||||
char *uri = extraio->temp ? strdup(extraio->io->uri) : 0;
|
||||
char *uri = extraio->temp ? vcos_strdup(extraio->io->uri) : 0;
|
||||
|
||||
while(extraio->refcount) vc_container_writer_extraio_disable(context, extraio);
|
||||
status = vc_container_io_close( extraio->io );
|
||||
|
||||
@@ -98,12 +98,12 @@ int main(int argc, char **argv)
|
||||
|
||||
if (psz_out)
|
||||
{
|
||||
psz_dump = strdup(psz_out);
|
||||
psz_dump = vcos_strdup(psz_out);
|
||||
} else {
|
||||
psz_dump = strrchr(psz_in, '\\'); if(psz_dump) psz_dump++;
|
||||
if(!psz_dump) {psz_dump = strrchr(psz_in, '/'); if(psz_dump) psz_dump++;}
|
||||
if(!psz_dump) psz_dump = strdup(psz_in);
|
||||
else psz_dump = strdup(psz_dump);
|
||||
if(!psz_dump) psz_dump = vcos_strdup(psz_in);
|
||||
else psz_dump = vcos_strdup(psz_dump);
|
||||
psz_dump[strlen(psz_dump)-1] = '1';
|
||||
}
|
||||
dump_file = fopen(psz_dump, "wb");
|
||||
|
||||
@@ -815,7 +815,13 @@ VCOS_INLINE_DECL void _vcos_thread_sem_post(VCOS_THREAD_T *);
|
||||
VCOS_STATIC_INLINE
|
||||
char *vcos_strdup(const char *str)
|
||||
{
|
||||
return strdup(str);
|
||||
size_t len = strlen(str) + 1;
|
||||
void *p = malloc(len);
|
||||
|
||||
if (p == NULL)
|
||||
return NULL;
|
||||
|
||||
return (char *)memcpy(p, str, len);
|
||||
}
|
||||
|
||||
typedef void (*VCOS_ISR_HANDLER_T)(VCOS_UNSIGNED vecnum);
|
||||
|
||||
Reference in New Issue
Block a user