Add an alias for the name for %N to the display sub-structure, so that the name can be varied between displays without having to alter the control value (#165).
This commit is contained in:
@@ -245,6 +245,14 @@ struct pvstate_s {
|
||||
/*****************
|
||||
* Display state *
|
||||
*****************/
|
||||
/*
|
||||
* Note that the "name" pointer is an alias - it should point to
|
||||
* some other string that's allocated and freed separately, such as
|
||||
* control.name. It is used here so that the name can be changed
|
||||
* for different display structures without having to also change
|
||||
* the control structure, for example when watching multiple file
|
||||
* descriptors with --watchfd.
|
||||
*/
|
||||
struct pvdisplay_s {
|
||||
|
||||
struct pvdisplay_segment_s { /* format string broken into segments */
|
||||
@@ -273,6 +281,8 @@ struct pvstate_s {
|
||||
off_t initial_offset; /* offset when first opened (when watching fds) */
|
||||
size_t next_line_len; /* length of currently receiving line so far */
|
||||
|
||||
/*@dependent@*/ /*@null@*/ const char *name; /* copy of pointer to string for %N */
|
||||
|
||||
size_t format_segment_count; /* number of format string segments */
|
||||
|
||||
pvtransfercount_t count_type; /* type of count for transfer, rate, etc */
|
||||
|
||||
Reference in New Issue
Block a user