[syslinux:master] lib: make chrreplace reachable for com32 modules
syslinux-bot for Erwan Velu
erwanaliasr1 at gmail.com
Mon Apr 25 15:27:48 PDT 2011
Commit-ID: 5b4b737c22587fb1879efab9d93630afcd835d62
Gitweb: http://syslinux.zytor.com/commit/5b4b737c22587fb1879efab9d93630afcd835d62
Author: Erwan Velu <erwanaliasr1 at gmail.com>
AuthorDate: Fri, 18 Mar 2011 18:28:52 +0100
Committer: Erwan Velu <erwanaliasr1 at gmail.com>
CommitDate: Fri, 18 Mar 2011 18:28:52 +0100
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 ;)
---
com32/include/ctype.h | 1 +
com32/lib/Makefile | 1 +
com32/lib/chrreplace.c | 11 +++++++++++
com32/lib/pci/scan.c | 11 +----------
4 files changed, 14 insertions(+), 10 deletions(-)
diff --git a/com32/include/ctype.h b/com32/include/ctype.h
index 83bbda1..6e0645e 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 48a166d..d65976b 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 0000000..65786f9
--- /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 c8334b1..4e5635f 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;
More information about the Syslinux-commits
mailing list