summaryrefslogtreecommitdiff
path: root/com32
diff options
context:
space:
mode:
authorErwan Velu <erwanaliasr1@gmail.com>2011-03-18 18:28:52 +0100
committerErwan Velu <erwanaliasr1@gmail.com>2011-03-18 18:28:52 +0100
commit5b4b737c22587fb1879efab9d93630afcd835d62 (patch)
treed8d2fd3e89e00a26672e1808618910c08b84e4cd /com32
parente19dc1cd0c218f453a96164d877c7f91b4a42bf8 (diff)
downloadsyslinux-5b4b737c22587fb1879efab9d93630afcd835d62.tar.gz
lib: make chrreplace reachable for com32 modules
chr_replace was only used in pci/scan.c but this could be useful for other modules like hdt ;)
Diffstat (limited to 'com32')
-rw-r--r--com32/include/ctype.h1
-rw-r--r--com32/lib/Makefile1
-rw-r--r--com32/lib/chrreplace.c11
-rw-r--r--com32/lib/pci/scan.c11
4 files changed, 14 insertions, 10 deletions
diff --git a/com32/include/ctype.h b/com32/include/ctype.h
index 83bbda1c..6e0645ee 100644
--- a/com32/include/ctype.h
+++ b/com32/include/ctype.h
@@ -117,5 +117,6 @@ __ctype_inline int tolower(int __c)
}
__extern char *skipspace(const char *p);
+__extern void chrreplace(char *source, char old, char new);
#endif /* _CTYPE_H */
diff --git a/com32/lib/Makefile b/com32/lib/Makefile
index 48a166dd..d65976be 100644
--- a/com32/lib/Makefile
+++ b/com32/lib/Makefile
@@ -28,6 +28,7 @@ LIBOBJS = \
asprintf.o vasprintf.o strlcpy.o strlcat.o \
vsscanf.o zalloc.o \
skipspace.o \
+ chrreplace.o \
\
lmalloc.o lstrdup.o \
\
diff --git a/com32/lib/chrreplace.c b/com32/lib/chrreplace.c
new file mode 100644
index 00000000..65786f94
--- /dev/null
+++ b/com32/lib/chrreplace.c
@@ -0,0 +1,11 @@
+#include <ctype.h>
+
+/* Replace char 'old' by char 'new' in source */
+void chrreplace(char *source, char old, char new)
+{
+ while (*source) {
+ source++;
+ if (source[0] == old) source[0]=new;
+ }
+}
+
diff --git a/com32/lib/pci/scan.c b/com32/lib/pci/scan.c
index c8334b11..4e5635f6 100644
--- a/com32/lib/pci/scan.c
+++ b/com32/lib/pci/scan.c
@@ -66,15 +66,6 @@ static int hex_to_int(char *hexa)
return strtoul(hexa, NULL, 16);
}
-/* Replace char 'old' by char 'new' in source */
-void chr_replace(char *source, char old, char new)
-{
- while (*source) {
- source++;
- if (source[0] == old) source[0]=new;
- }
-}
-
/* Try to match any pci device to the appropriate kernel module */
/* it uses the modules.pcimap from the boot device */
int get_module_name_from_pcimap(struct pci_domain *domain,
@@ -135,7 +126,7 @@ int get_module_name_from_pcimap(struct pci_domain *domain,
* in the module name whereas modules.alias is only using '_'.
* To avoid kernel modules duplication, let's rename all '-' in '_'
* to match what modules.alias provides */
- case 0:chr_replace(result,'-','_');strcpy(module_name,result); break;
+ case 0:chrreplace(result,'-','_');strcpy(module_name,result); break;
case 1:strcpy(vendor_id,result); break;
case 2:strcpy(product_id,result); break;
case 3:strcpy(sub_vendor_id,result); break;