Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 323806
b: refs/heads/master
c: b232e07
h: refs/heads/master
v: v3
  • Loading branch information
Jiri Olsa authored and Arnaldo Carvalho de Melo committed Sep 11, 2012
1 parent 6e83364 commit 8ab7cf5
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 2 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: bdde37163e1fd474509aab90f5eaacee46100107
refs/heads/master: b232e0732b1d763834c3d5b098d25d59337ba075
2 changes: 2 additions & 0 deletions trunk/tools/perf/util/include/linux/string.h
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
#include <string.h>

void *memdup(const void *src, size_t len);
18 changes: 17 additions & 1 deletion trunk/tools/perf/util/string.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "util.h"
#include "string.h"
#include "linux/string.h"

#define K 1024LL
/*
Expand Down Expand Up @@ -335,3 +335,19 @@ char *rtrim(char *s)

return s;
}

/**
* memdup - duplicate region of memory
* @src: memory region to duplicate
* @len: memory region length
*/
void *memdup(const void *src, size_t len)
{
void *p;

p = malloc(len);
if (p)
memcpy(p, src, len);

return p;
}

0 comments on commit 8ab7cf5

Please sign in to comment.