C Programming Question ...

Roger Oberholtzer roger
Mon Mar 19 08:32:33 PDT 2007


On Mon, 2007-03-19 at 08:54 -0500, Ben Duncan wrote: 
> Ok, working on a OLD project ...

Would need to see the definition for PyMethodDef. I bet it is something
like a 'const char *'  in one place, and  a 'char *' in another.

I am also curious about the PyCFunction)apgn_close and similar
statements.


> 
> Have this defined:
> 
> /* Next line is line line 519 */
> static PyMethodDef apgn_methods[] = {
>          {"close", , METH_VARARGS, /* LINE 520 */
>           "close() \n Close the database."},
>          {"keys",  PyCFunction)apgn_keys, METH_VARARGS, /* Line 522 */
>           "keys() -> list \n Return a list of all keys in the database."},
>          {"has_key", (PyCFunction)apgn_has_key,      METH_VARARGS,
>           "has_key(key) -> boolean \n Return true iff key is in the database."},
>          {"readrec", PyCFunction)apgn_read,         METH_VARARGS,
>           "readrec(key, lock) \n"
>           "Read an Appgen record - Does not return any DATA PORTION. \n"
>           "IF lock is non-zero will attempt to lock that record \n"
>           "But if unsucessfull will return lock status \n."},
>          {"newrec",  (PyCFunction)apgn_newrec,       METH_VARARGS,
>           "newrec(key) -> creates a new record \n"
>           "Creates a new record space with key and locks that record."},
>          {"writerec", (PyCFunction)apgn_writerec,     METH_VARARGS,
>           "writerec(key) -> Writes back record \n"
>           "This will write back the current record."},
>          {"delrec",   (PyCFunction)apgn_delrec,       METH_VARARGS,
>           "delrec(key) -> Deletes record \n"
>           "IF the current record is locked, will delete record."},
>          {"releaserec",  (PyCFunction)apgn_relrec,       METH_VARARGS,
>           "releaserec() - release any LOCKS on databse youmightr have \n"},
>          {"extract", (PyCFunction)apgn_extract,      METH_VARARGS,
>           "extract(Attribute, Subval) -> Extract a Attribute \n"},
>          {"replace", (PyCFunction)apgn_replace,      METH_VARARGS,
>           "replace(String, Attribute, Subval) -> Replace a Attribute \n"},
>          {"insert",  (PyCFunction)apgn_insert,       METH_VARARGS,
>           "insert(String, Attribute, Subval) -> Insert a Attribute \n"},
>          {NULL,          NULL}           /* sentinel */
> };
> 
> Am getting these warnings ...
> appgen.c:520: warning: initialization discards qualifiers from pointer target type
> appgen.c:521: warning: initialization discards qualifiers from pointer target type
> appgen.c:522: warning: initialization discards qualifiers from pointer target type
> appgen.c:523: warning: initialization discards qualifiers from pointer target type
> appgen.c:524: warning: initialization discards qualifiers from pointer target type
> appgen.c:525: warning: initialization discards qualifiers from pointer target type
> appgen.c:526: warning: initialization discards qualifiers from pointer target type
> appgen.c:530: warning: initialization discards qualifiers from pointer target type
> appgen.c:531: warning: initialization discards qualifiers from pointer target type
> appgen.c:533: warning: initialization discards qualifiers from pointer target type
> .............
> 
> and so on ....
> 
> 
> What Is this saying to me ? Poor Programming practice? Can I fix this?
> Ignore this ? What do I need to do ?
> 
> Thanks ...
> 
> 
> 
-- 
Roger Oberholtzer

OPQ Systems / Ramb?ll RST

Ramb?ll Sverige AB
Kapellgr?nd 7
P.O. Box 4205
SE-102 65 Stockholm, Sweden

Tel: Int +46 8-615 60 20
Fax: Int +46 8-31 42 23




More information about the Linux-users mailing list