Reserve first 1000 values for states
The task type hash starts at 1000, so we don't collide with states.
This commit is contained in:
parent
70b29b6459
commit
029e185c6c
@ -10,6 +10,10 @@
|
|||||||
|
|
||||||
#define MAX_PCF_LABEL 512
|
#define MAX_PCF_LABEL 512
|
||||||
|
|
||||||
|
enum pcf_values {
|
||||||
|
PCF_RESERVED = 1000,
|
||||||
|
};
|
||||||
|
|
||||||
struct pcf_value {
|
struct pcf_value {
|
||||||
int value;
|
int value;
|
||||||
char label[MAX_PCF_LABEL];
|
char label[MAX_PCF_LABEL];
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "thread.h"
|
#include "thread.h"
|
||||||
|
#include "pv/pcf.h"
|
||||||
#include "utlist.h"
|
#include "utlist.h"
|
||||||
|
|
||||||
struct task *
|
struct task *
|
||||||
@ -232,14 +233,15 @@ task_get_type_gid(const char *label)
|
|||||||
|
|
||||||
HASH_VALUE(label, strlen(label), gid);
|
HASH_VALUE(label, strlen(label), gid);
|
||||||
|
|
||||||
/* Use non-negative values */
|
|
||||||
gid &= 0x7FFFFFFF;
|
|
||||||
|
|
||||||
/* Avoid bad colors for "Unlabeled0" and "main" */
|
/* Avoid bad colors for "Unlabeled0" and "main" */
|
||||||
gid += 666;
|
gid += 666;
|
||||||
|
|
||||||
if (gid == 0)
|
/* Use non-negative values */
|
||||||
gid++;
|
gid &= 0x7FFFFFFF;
|
||||||
|
|
||||||
|
/* Avoid reserved values */
|
||||||
|
if (gid < PCF_RESERVED)
|
||||||
|
gid += PCF_RESERVED;
|
||||||
|
|
||||||
return gid;
|
return gid;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user