|
@@ -94,19 +94,20 @@ struct comm *comm__new(const char *str, u64 timestamp)
|
|
|
return comm;
|
|
|
}
|
|
|
|
|
|
-void comm__override(struct comm *comm, const char *str, u64 timestamp)
|
|
|
+int comm__override(struct comm *comm, const char *str, u64 timestamp)
|
|
|
{
|
|
|
- struct comm_str *old = comm->comm_str;
|
|
|
+ struct comm_str *new, *old = comm->comm_str;
|
|
|
|
|
|
- comm->comm_str = comm_str__findnew(str, &comm_str_root);
|
|
|
- if (!comm->comm_str) {
|
|
|
- comm->comm_str = old;
|
|
|
- return;
|
|
|
- }
|
|
|
+ new = comm_str__findnew(str, &comm_str_root);
|
|
|
+ if (!new)
|
|
|
+ return -ENOMEM;
|
|
|
|
|
|
- comm->start = timestamp;
|
|
|
- comm_str__get(comm->comm_str);
|
|
|
+ comm_str__get(new);
|
|
|
comm_str__put(old);
|
|
|
+ comm->comm_str = new;
|
|
|
+ comm->start = timestamp;
|
|
|
+
|
|
|
+ return 0;
|
|
|
}
|
|
|
|
|
|
void comm__free(struct comm *comm)
|