On Tue, 8 Aug 2023 17:51:05 -0400 Stevie Alvarez <stevie.6strings@xxxxxxxxx> wrote: > On Tue, Aug 08, 2023 at 03:35:47PM -0400, Steven Rostedt wrote: > > On Tue, 8 Aug 2023 12:11:54 -0400 > > Stevie Alvarez <stevie.6strings@xxxxxxxxx> wrote: > > > > > +/* > > > + * Trace data entry for a traceeval histogram > > > + * Constitutes keys and values. > > > + */ > > > +union traceeval_data { > > > + char *string; > > > > We need to also add: > > > > const char *cstring; > > > > At least for the user interface, as I'm converting task-eval over to this, > > and I need to assign const strings to this union. > > I assume I should treat cstring the same as string, execept because it's > constant, it should not be updated on insertion, correct? On insertion we have: static int copy_traceeval_data(struct traceeval_type *type, const union traceeval_data *orig, union traceeval_data *copy) { *copy = *orig; switch (type->type) { case TRACEEVAL_TYPE_STRING: copy->string = NULL; if (orig->string) copy->string = strdup(orig->string); if (!copy->string) return -1; break; default: break; } return 0; } So we copy it. That means we really can do whatever we want to it. -- Steve
![]() |