Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 163796
b: refs/heads/master
c: ec60a3f
h: refs/heads/master
v: v3
  • Loading branch information
Arjan van de Ven authored and Ingo Molnar committed Sep 19, 2009
1 parent ce5f56b commit 7384eb2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 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: 151750cec5db3c7ea45255d2901e581e2162317a
refs/heads/master: ec60a3fe478c0fc6d109eb5840b435ecee4d132b
14 changes: 7 additions & 7 deletions trunk/tools/perf/util/header.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,8 @@
#include "header.h"

/*
*
* Create new perf.data header attribute:
*/

struct perf_header_attr *perf_header_attr__new(struct perf_counter_attr *attr)
{
struct perf_header_attr *self = malloc(sizeof(*self));
Expand Down Expand Up @@ -43,9 +42,8 @@ void perf_header_attr__add_id(struct perf_header_attr *self, u64 id)
}

/*
*
* Create new perf.data header:
*/

struct perf_header *perf_header__new(void)
{
struct perf_header *self = malloc(sizeof(*self));
Expand Down Expand Up @@ -86,17 +84,19 @@ void perf_header__add_attr(struct perf_header *self,
self->attr[pos] = attr;
}

#define MAX_EVENT_NAME 64

struct perf_trace_event_type {
u64 event_id;
char name[64];
char name[MAX_EVENT_NAME];
};

static int event_count;
static struct perf_trace_event_type *events;

void perf_header__push_event(u64 id, const char *name)
{
if (strlen(name) > 64)
if (strlen(name) > MAX_EVENT_NAME)
printf("Event %s will be truncated\n", name);

if (!events) {
Expand All @@ -110,7 +110,7 @@ void perf_header__push_event(u64 id, const char *name)
}
memset(&events[event_count], 0, sizeof(struct perf_trace_event_type));
events[event_count].event_id = id;
strncpy(events[event_count].name, name, 63);
strncpy(events[event_count].name, name, MAX_EVENT_NAME - 1);
event_count++;
}

Expand Down

0 comments on commit 7384eb2

Please sign in to comment.