diff options
author | nima <nima@abc39116-655e-4be6-ad55-d661dc543056> | 2008-07-24 14:17:16 +0000 |
---|---|---|
committer | nima <nima@abc39116-655e-4be6-ad55-d661dc543056> | 2008-07-24 14:17:16 +0000 |
commit | 24088a00c8ca6e9743ee6bba4ddf958fbe3149cb (patch) | |
tree | cc23be8e9bbf5b63bc328c87ccdeebc6b8ddb63c | |
parent | c0c4e2446ffca88aed27726fd28f99470fb85d40 (diff) | |
download | python-dmidecode-24088a00c8ca6e9743ee6bba4ddf958fbe3149cb.tar.gz python-dmidecode-24088a00c8ca6e9743ee6bba4ddf958fbe3149cb.tar.xz python-dmidecode-24088a00c8ca6e9743ee6bba4ddf958fbe3149cb.zip |
Cleanup.
git-svn-id: svn://svn.autonomy.net.au/python-dmidecode@14 abc39116-655e-4be6-ad55-d661dc543056
-rw-r--r-- | Makefile | 43 | ||||
-rw-r--r-- | catsprintf.c | 4 | ||||
-rw-r--r-- | dmidecode.c | 2 | ||||
-rw-r--r-- | dmidecodebin.c | 2 |
4 files changed, 26 insertions, 25 deletions
@@ -9,18 +9,19 @@ # CC = gcc -CFLAGS = -W -Wall -Wshadow -Wstrict-prototypes -Wpointer-arith -Wcast-qual \ - -Wcast-align -Wwrite-strings -Wmissing-prototypes -Winline -Wundef \ - -L/usr/include/python2.4 - +CFLAGS = -fno-strict-aliasing +CFLAGS += -W -Wall -Wshadow -Wstrict-prototypes -Wpointer-arith -Wcast-align -Wwrite-strings -Wmissing-prototypes -Winline -Wundef #-Wcast-qual +CFLAGS += -I/usr/include/python2.4 +#. #CFLAGS += -DBIGENDIAN #CFLAGS += -DALIGNMENT_WORKAROUND +#. +#. When debugging, disable -O2 and enable -g. +CFLAGS += -g -DNDEBUG +CFLAGS += -O2 -# When debugging, disable -O2 and enable -g. -#CFLAGS += -O2 -#CFLAGS += -g -lefence -I/usr/include/python2.4 -CFLAGS += -g -I/usr/include/python2.4 +SOFLAGS = -shared -fPIC # Pass linker flags here LDFLAGS = -I/usr/include/python2.4 @@ -46,31 +47,28 @@ PROGRAMS += $(shell test `uname -m 2>/dev/null` != ia64 && echo biosdecode owner PROGRAMS != echo dmidecode ; test `uname -m 2>/dev/null` != ia64 && echo biosdecode ownership vpddecode -mod: +all : $(PROGRAMS) + +module: sudo python setup.py clean python setup.py build sudo python setup.py install python -c 'import dmidecode' -all : $(PROGRAMS) - sudo python setup.py install - python -c 'import dmidecode' + +# +# Shared Objects +# + +libdmidecode.so: dmidecode.o util.o + $(CC) $(LDFLAGS) $(SOFLAGS) $< -o $@ # # Programs # -#. NiMA... -#dmidecode : dmidecode.o dmiopt.o dmioem.o util.o -# $(CC) $(LDFLAGS) dmidecode.o dmiopt.o dmioem.o util.o -o $@ dmidecode: dmidecodebin.c catsprintf.o libdmidecode.so dmidecode.o dmiopt.o dmioem.o util.o $(CC) $(LDFLAGS) $< -L. -ldmidecode -lpython2.4 catsprintf.o dmidecode.o dmiopt.o dmioem.o util.o -o $@ -libdmidecode.so: dmidecode.o util.o - $(CC) $(LDFLAGS) -shared -fPIC -lpython2.4 -L. $< -o $@ -catsprintf.o: catsprintf.c catsprintf.h - $(CC) $(CFLAGS) -c $< -o $@ -#. ...NiMA - biosdecode : biosdecode.o util.o $(CC) $(LDFLAGS) biosdecode.o util.o -o $@ @@ -109,6 +107,9 @@ vpdopt.o : vpdopt.c config.h util.h vpdopt.h util.o : util.c types.h util.h config.h $(CC) $(CFLAGS) -c $< -o $@ +catsprintf.o: catsprintf.c catsprintf.h + $(CC) $(CFLAGS) -c $< -o $@ + # # Commands # diff --git a/catsprintf.c b/catsprintf.c index 2b0abb3..e914e6d 100644 --- a/catsprintf.c +++ b/catsprintf.c @@ -63,7 +63,7 @@ dmi_minor* dmiAppendObject(long code, char const *key, const char *format, ...) dmi_minor *o = (dmi_minor *)malloc(sizeof(dmi_minor)); o->id = code; - o->major = (dmi_codes_major*)&dmiCodesMajor[map_maj[code>>8]]; + o->major = (dmi_codes_major *)&dmiCodesMajor[map_maj[code>>8]]; o->key = (char *)key; vsprintf(o->value, format, arg); o->next = last; @@ -81,7 +81,7 @@ int dmiSetItem(PyObject* dict, const char *key, const char *format, ...) { vsprintf(buffer, format, arg); va_end(arg); //printf("DEBUG: Setting k:%s, f:%s s:%s...", key, format, buffer); - PyDict_SetItem(dict, Py_BuildValue("s", key), Py_BuildValue("s", buffer)); + PyDict_SetItem(dict, PyString_FromString(key), PyString_FromString(buffer)); //printf("Done.\n"); return 0; } diff --git a/dmidecode.c b/dmidecode.c index 54b0290..b410170 100644 --- a/dmidecode.c +++ b/dmidecode.c @@ -3329,7 +3329,7 @@ static void dmi_table(u32 base, u16 len, u16 num, u16 ver, const char *devmem, P } } - PyDict_SetItem(pydata, Py_BuildValue("s", hid), hDict); + PyDict_SetItem(pydata, PyString_FromString(hid), hDict); data=next; i++; diff --git a/dmidecodebin.c b/dmidecodebin.c index 8704a36..effe8b7 100644 --- a/dmidecodebin.c +++ b/dmidecodebin.c @@ -22,7 +22,7 @@ #include "catsprintf.h" extern const char *dmi_dump(struct dmi_header *h, char *_); -extern void dmi_decode(struct dmi_header *h, u16 ver); +extern void dmi_decode(struct dmi_header *h, u16 ver, PyObject *pydata); extern int address_from_efi(size_t *address, char *_); extern void to_dmi_header(struct dmi_header *h, u8 *data); extern void dmi_table(u32 base, u16 len, u16 num, u16 ver, const char *devmem); |