]> mj.ucw.cz Git - pciutils.git/commitdiff
Library: pci_define_param() returns a pointer to the parameter
authorMartin Mares <mj@ucw.cz>
Sun, 18 Feb 2024 00:35:59 +0000 (01:35 +0100)
committerMartin Mares <mj@ucw.cz>
Sun, 18 Feb 2024 00:35:59 +0000 (01:35 +0100)
This will allow overriding pci_param->malloced.

lib/internal.h
lib/params.c

index 4c5573945ce59ac8ef0b9d40d75e128e03f59020..64836b9b05f6e27b519b95f4e7e3d960d5e7faff 100644 (file)
@@ -127,7 +127,7 @@ struct pci_property {
 char *pci_set_property(struct pci_dev *d, u32 key, char *value);
 
 /* params.c */
-void pci_define_param(struct pci_access *acc, char *param, char *val, char *help);
+struct pci_param *pci_define_param(struct pci_access *acc, char *param, char *val, char *help);
 int pci_set_param_internal(struct pci_access *acc, char *param, char *val, int copy);
 void pci_free_params(struct pci_access *acc);
 
index ac756ad79a313661e13f3d67cf85ec5e3cd43bf6..9b4c2e21e4de819382f1bbca07fc0969a8654dfa 100644 (file)
@@ -25,7 +25,7 @@ pci_get_param(struct pci_access *acc, char *param)
   return NULL;
 }
 
-void
+struct pci_param *
 pci_define_param(struct pci_access *acc, char *param, char *value, char *help)
 {
   struct pci_param *p, **pp;
@@ -37,7 +37,7 @@ pci_define_param(struct pci_access *acc, char *param, char *value, char *help)
        {
          if (strcmp(p->value, value) || strcmp(p->help, help))
            acc->error("Parameter %s re-defined differently", param);
-         return;
+         return p;
        }
       if (cmp > 0)
        break;
@@ -50,6 +50,7 @@ pci_define_param(struct pci_access *acc, char *param, char *value, char *help)
   p->value = value;
   p->value_malloced = 0;
   p->help = help;
+  return p;
 }
 
 int