diff options
author | jbj <devnull@localhost> | 2004-05-27 19:00:51 +0000 |
---|---|---|
committer | jbj <devnull@localhost> | 2004-05-27 19:00:51 +0000 |
commit | 6aed2fa8ac85c8bc8f116309c2d96bd0e45263c8 (patch) | |
tree | 6ed99a43c7f35c8513f500370ece814f6376ab04 /rpmio/sexp | |
parent | 26371c10a6237a016419d22cc8d773e32cd587e8 (diff) | |
download | librpm-tizen-6aed2fa8ac85c8bc8f116309c2d96bd0e45263c8.tar.gz librpm-tizen-6aed2fa8ac85c8bc8f116309c2d96bd0e45263c8.tar.bz2 librpm-tizen-6aed2fa8ac85c8bc8f116309c2d96bd0e45263c8.zip |
ANSI C prototypes, no-brainer splint annotations.
CVS patchset: 7255
CVS date: 2004/05/27 19:00:51
Diffstat (limited to 'rpmio/sexp')
-rw-r--r-- | rpmio/sexp/.splintrc | 80 | ||||
-rw-r--r-- | rpmio/sexp/sexp-basic.c | 69 | ||||
-rw-r--r-- | rpmio/sexp/sexp-input.c | 78 | ||||
-rw-r--r-- | rpmio/sexp/sexp-main.c | 4 | ||||
-rw-r--r-- | rpmio/sexp/sexp-output.c | 116 | ||||
-rw-r--r-- | rpmio/sexp/sexp.h | 227 |
6 files changed, 309 insertions, 265 deletions
diff --git a/rpmio/sexp/.splintrc b/rpmio/sexp/.splintrc new file mode 100644 index 000000000..cade55d68 --- /dev/null +++ b/rpmio/sexp/.splintrc @@ -0,0 +1,80 @@ +-I. -DHAVE_CONFIG_H -D_GNU_SOURCE + +#+partial ++forcehints + +-warnposix + ++unixlib + +-unrecogcomments # XXX ignore doxygen markings + ++strict # lclint level + +# --- in progress +-branchstate +-bufferoverflowhigh +-compdef +-dependenttrans +-evalorder +-exitarg +-exportheadervar +-exportlocal +-fcnuse +-formatconst +-globs +-globstate +-ifempty +-infloopsuncon +-internalglobs +-mods +-noeffect +-noeffectuncon +-nullpass +-nullret +-nullstate +-paramuse +-readonlytrans +-retalias +-retvalint +-shiftimplementation +-shiftnegative +-sizeoftype +-temptrans +-unqualifiedtrans +-usereleased + +# --- +partial artifacts + +# --- not-yet at strict level +-bitwisesigned # +-elseifcomplete # +-exportconst # +-exportfcn # +-exporttype # +-exportvar # +-fielduse # +-forblock # tedious +-ifblock # tedious +-namechecks # tedious ANSI compliance checks +-ptrarith # + +-compdestroy # +-mustdefine # +-sys-dir-errors + +-strictops # +-whileblock # tedious + +# --- not-yet at checks level ++enumint # +-mustfree # +-predboolptr # +-usedef # + +# --- not-yet at standard level +-boolops # ++boolint # ++charint # ++ignorequals # ++matchanyintegral # diff --git a/rpmio/sexp/sexp-basic.c b/rpmio/sexp/sexp-basic.c index f9f319ead..a833f985f 100644 --- a/rpmio/sexp/sexp-basic.c +++ b/rpmio/sexp/sexp-basic.c @@ -18,10 +18,7 @@ * c1 and c2 are (optional) integer parameters for the message.
* Terminates iff level==ERROR, otherwise returns.
*/
-void ErrorMessage(level,msg,c1,c2)
-int level;
-char *msg;
-int c1, c2;
+void ErrorMessage(int level, const char *msg, int c1, int c2)
{
fflush(stdout);
printf("\n*** ");
@@ -39,15 +36,14 @@ int c1, c2; /* initializeMemory()
* take care of memory initialization
*/
-void initializeMemory()
+void initializeMemory(void)
{ ; } /* nothing in this implementation -- use malloc */
/* sexpAlloc(n)
* Allocates n bytes of storage.
* Terminates execution if no memory available.
*/
-char *sexpAlloc(n)
-int n;
+char *sexpAlloc(int n)
{ char *c = (char *)malloc((unsigned int) n);
if (c == NULL) ErrorMessage(ERROR,"Error in sexpAlloc: out of memory!",0,0);
return(c);
@@ -61,7 +57,7 @@ int n; * Creates and initializes new sexpSimpleString object.
* Allocates 16-character buffer to hold string.
*/
-sexpSimpleString *newSimpleString()
+sexpSimpleString *newSimpleString(void)
{
sexpSimpleString *ss;
ss = (sexpSimpleString *) sexpAlloc(sizeof(sexpSimpleString));
@@ -74,23 +70,20 @@ sexpSimpleString *newSimpleString() /* simpleStringLength(ss)
* returns length of simple string
*/
-long int simpleStringLength(ss)
-sexpSimpleString *ss;
+long int simpleStringLength(sexpSimpleString *ss)
{ return(ss->length); }
/* simpleStringString(ss)
* returns pointer to character array of simple string
*/
-octet *simpleStringString(ss)
-sexpSimpleString *ss;
+octet *simpleStringString(sexpSimpleString *ss)
{ return(ss->string); }
/* reallocateSimpleString(ss)
* Changes space allocated to ss.
* Space allocated is set to roughly 3/2 the current string length, plus 16.
*/
-sexpSimpleString *reallocateSimpleString(ss)
-sexpSimpleString *ss;
+sexpSimpleString *reallocateSimpleString(sexpSimpleString *ss)
{
int newsize, i;
octet *newstring;
@@ -115,9 +108,7 @@ sexpSimpleString *ss; * Appends the character c to the end of simple string ss.
* Reallocates storage assigned to s if necessary to make room for c.
*/
-void appendCharToSimpleString(c,ss)
-int c;
-sexpSimpleString *ss;
+void appendCharToSimpleString(int c, sexpSimpleString *ss)
{
if (ss==NULL) ss = newSimpleString();
if (ss->string == NULL || ss->length == ss->allocatedLength )
@@ -134,7 +125,7 @@ sexpSimpleString *ss; * Creates and initializes a new sexpString object.
* Both the presentation hint and the string are initialized to NULL.
*/
-sexpString *newSexpString()
+sexpString *newSexpString(void)
{
sexpString *s;
s = (sexpString *) sexpAlloc(sizeof(sexpString));
@@ -147,38 +138,31 @@ sexpString *newSexpString() /* sexpStringPresentationHint()
* returns presentation hint field of the string
*/
-sexpSimpleString *sexpStringPresentationHint(s)
-sexpString *s;
+sexpSimpleString *sexpStringPresentationHint(sexpString *s)
{ return(s->presentationHint); }
/* setSexpStringPresentationHint()
* assigns the presentation hint field of the string
*/
-void setSexpStringPresentationHint(s,ss)
-sexpString *s;
-sexpSimpleString *ss;
+void setSexpStringPresentationHint(sexpString *s, sexpSimpleString *ss)
{ s->presentationHint = ss; }
/* setSexpStringString()
* assigns the string field of the string
*/
-void setSexpStringString(s,ss)
-sexpString *s;
-sexpSimpleString *ss;
+void setSexpStringString(sexpString *s, sexpSimpleString *ss)
{ s->string = ss; }
/* sexpStringString()
* returns the string field of the string
*/
-sexpSimpleString *sexpStringString(s)
-sexpString *s;
+sexpSimpleString *sexpStringString(sexpString *s)
{ return(s->string); }
/* closeSexpString()
* finish up string computations after created
*/
-void closeSexpString(s)
-sexpString *s;
+void closeSexpString(sexpString *s)
{ ; } /* do nothing in this implementation */
/**************************/
@@ -190,7 +174,7 @@ sexpString *s; * Both the first and rest fields are initialized to NULL, which is
* SEXP's representation of an empty list.
*/
-sexpList *newSexpList()
+sexpList *newSexpList(void)
{
sexpList *list;
list = (sexpList *) sexpAlloc(sizeof(sexpList));
@@ -203,9 +187,7 @@ sexpList *newSexpList() /* sexpAddSexpListObject()
* add object to end of list
*/
-void sexpAddSexpListObject(list,object)
-sexpList *list;
-sexpObject *object;
+void sexpAddSexpListObject(sexpList *list, sexpObject *object)
{
if (list->first == NULL)
list->first = object;
@@ -220,8 +202,7 @@ sexpObject *object; /* closeSexpList()
* finish off a list that has just been input
*/
-void closeSexpList(list)
-sexpList *list;
+void closeSexpList(sexpList *list)
{ ; } /* nothing in this implementation */
/* Iteration on lists.
@@ -232,15 +213,13 @@ sexpList *list; /* sexpListIter()
* return the iterator for going over a list
*/
-sexpIter *sexpListIter(list)
-sexpList *list;
+sexpIter *sexpListIter(sexpList *list)
{ return((sexpIter *)list); }
/* sexpIterNext()
* advance iterator to next element of list, or else return null
*/
-sexpIter *sexpIterNext(iter)
-sexpIter *iter;
+sexpIter *sexpIterNext(sexpIter *iter)
{ if (iter == NULL) return(NULL);
return((sexpIter *)(((sexpList *)iter)->rest));
}
@@ -248,8 +227,7 @@ sexpIter *iter; /* sexpIterObject ()
* return object corresponding to current state of iterator
*/
-sexpObject *sexpIterObject(iter)
-sexpIter *iter;
+sexpObject *sexpIterObject(sexpIter *iter)
{ if (iter == NULL) return(NULL);
return(((sexpList *)iter)->first);
}
@@ -258,15 +236,12 @@ sexpIter *iter; /* SEXP OBJECT MANIPULATION */
/****************************/
-int isObjectString(object)
-sexpObject *object;
+int isObjectString(sexpObject *object)
{ if (((sexpString *)object)->type == SEXP_STRING) return(TRUE);
else return(FALSE);
}
-int isObjectList(object)
-sexpObject *object;
+int isObjectList(sexpObject *object)
{ if (((sexpList *)object)->type == SEXP_LIST) return(TRUE);
else return(FALSE);
}
-
diff --git a/rpmio/sexp/sexp-input.c b/rpmio/sexp/sexp-input.c index 79043672d..ff1c06461 100644 --- a/rpmio/sexp/sexp-input.c +++ b/rpmio/sexp/sexp-input.c @@ -25,7 +25,7 @@ char alpha[256]; /* alpha[c] is true if c is alphabetic A-Z a-z */ /* initializeCharacterTables
* initializes all of the above arrays
*/
-void initializeCharacterTables()
+void initializeCharacterTables(void)
{ int i;
for (i=0;i<256;i++) upper[i] = i;
for (i='a'; i<='z'; i++) upper[i] = i - 'a' + 'A';
@@ -68,43 +68,37 @@ void initializeCharacterTables() /* isWhiteSpace(c)
* Returns TRUE if c is a whitespace character (space, tab, etc. ).
*/
-int isWhiteSpace(c)
-int c;
+int isWhiteSpace(int c)
{ return ((c>=0 && c<=255) && whitespace[c]); }
/* isDecDigit(c)
* Returns TRUE if c is a decimal digit.
*/
-int isDecDigit(c)
-int c;
+int isDecDigit(int c)
{ return ((c>=0 && c<=255) && decdigit[c]); }
/* isHexDigit(c)
* Returns TRUE if c is a hexadecimal digit.
*/
-int isHexDigit(c)
-int c;
+int isHexDigit(int c)
{ return ((c>=0 && c<=255) && hexdigit[c]); }
/* isBase64Digit(c)
* returns TRUE if c is a base64 digit A-Z,a-Z,0-9,+,/
*/
-int isBase64Digit(c)
-int c;
+int isBase64Digit(int c)
{ return ((c>=0 && c<=255) && base64digit[c]); }
/* isTokenChar(c)
* Returns TRUE if c is allowed in a token
*/
-int isTokenChar(c)
-int c;
+int isTokenChar(int c)
{ return ((c>=0 && c<=255) && tokenchar[c]); }
/* isAlpha(c)
* Returns TRUE if c is alphabetic
*/
-int isAlpha(c)
-int c;
+int isAlpha(int c)
{ return ((c>=0 && c<=255) && alpha[c]); }
/**********************/
@@ -113,9 +107,7 @@ int c; /* changeInputByteSize(is,newByteSize)
*/
-void changeInputByteSize(is,newByteSize)
-sexpInputStream *is;
-int newByteSize;
+void changeInputByteSize(sexpInputStream *is, int newByteSize)
{
is->byteSize = newByteSize;
is->nBits = 0;
@@ -130,8 +122,7 @@ int newByteSize; * The value EOF is obtained when no more input is available.
* This code handles 4-bit/6-bit/8-bit channels.
*/
-void getChar(is)
-sexpInputStream *is;
+void getChar(sexpInputStream *is)
{ int c;
if (is->nextChar == EOF)
{ is->byteSize = 8;
@@ -185,7 +176,7 @@ sexpInputStream *is; * (Prefixes stream with one blank, and initializes stream
* so that it reads from standard input.)
*/
-sexpInputStream *newSexpInputStream()
+sexpInputStream *newSexpInputStream(void)
{
sexpInputStream *is;
is = (sexpInputStream *) sexpAlloc(sizeof(sexpInputStream));
@@ -206,8 +197,7 @@ sexpInputStream *newSexpInputStream() /* skipWhiteSpace(is)
* Skip over any white space on the given sexpInputStream.
*/
-void skipWhiteSpace(is)
-sexpInputStream *is;
+void skipWhiteSpace(sexpInputStream *is)
{
while (isWhiteSpace(is->nextChar)) is->getChar(is);
}
@@ -216,9 +206,7 @@ sexpInputStream *is; * Skip the following input character on input stream is, if it is
* equal to the character c. If it is not equal, then an error occurs.
*/
-void skipChar(is,c)
-sexpInputStream *is;
-int c;
+void skipChar(sexpInputStream *is, int c)
{
if (is->nextChar==c)
is->getChar(is);
@@ -231,9 +219,7 @@ int c; /* scanToken(is,ss)
* scan one or more characters into simple string ss as a token.
*/
-void scanToken(is,ss)
-sexpInputStream *is;
-sexpSimpleString *ss;
+void scanToken(sexpInputStream *is, sexpSimpleString *ss)
{
skipWhiteSpace(is);
while (isTokenChar(is->nextChar))
@@ -248,8 +234,7 @@ sexpSimpleString *ss; * scan one or more characters (until EOF reached)
* return an object that is just that string
*/
-sexpObject *scanToEOF(is)
-sexpInputStream *is;
+sexpObject *scanToEOF(sexpInputStream *is)
{
sexpSimpleString *ss = newSimpleString();
sexpString *s = newSexpString();
@@ -266,8 +251,7 @@ sexpInputStream *is; /* scanDecimal(is)
* returns long integer that is value of decimal number
*/
-unsigned long int scanDecimal(is)
-sexpInputStream *is;
+unsigned long int scanDecimal(sexpInputStream *is)
{ unsigned long int value = 0L;
int i = 0;
while (isDecDigit(is->nextChar))
@@ -282,10 +266,7 @@ sexpInputStream *is; /* scanVerbatimString(is,ss,length)
* Reads verbatim string of given length into simple string ss.
*/
-void scanVerbatimString(is,ss,length)
-sexpInputStream *is;
-sexpSimpleString *ss;
-long int length;
+void scanVerbatimString(sexpInputStream *is, sexpSimpleString *ss, long int length)
{
long int i = 0L;
skipWhiteSpace(is);
@@ -304,10 +285,7 @@ long int length; * Handles ordinary C escapes.
* If of indefinite length, length is -1.
*/
-void scanQuotedString(is,ss,length)
-sexpInputStream *is;
-sexpSimpleString *ss;
-long int length;
+void scanQuotedString(sexpInputStream *is, sexpSimpleString *ss, long int length)
{
int c;
skipChar(is,'"');
@@ -392,10 +370,7 @@ long int length; * Reads hexadecimal string into simple string ss.
* String is of given length result, or length = -1 if indefinite length.
*/
-void scanHexString(is,ss,length)
-sexpInputStream *is;
-sexpSimpleString *ss;
-long int length;
+void scanHexString(sexpInputStream *is, sexpSimpleString *ss, long int length)
{ changeInputByteSize(is,4);
skipChar(is,'#');
while (is->nextChar != EOF && (is->nextChar != '#' || is->byteSize==4))
@@ -415,10 +390,7 @@ long int length; * Reads base64 string into simple string ss.
* String is of given length result, or length = -1 if indefinite length.
*/
-void scanBase64String(is,ss,length)
-sexpInputStream *is;
-sexpSimpleString *ss;
-long int length;
+void scanBase64String(sexpInputStream *is, sexpSimpleString *ss, long int length)
{ changeInputByteSize(is,6);
skipChar(is,'|');
while (is->nextChar != EOF && (is->nextChar != '|' || is->byteSize == 6))
@@ -439,8 +411,7 @@ long int length; * Determines type of simple string from the initial character, and
* dispatches to appropriate routine based on that.
*/
-sexpSimpleString *scanSimpleString(is)
-sexpInputStream *is;
+sexpSimpleString *scanSimpleString(sexpInputStream *is)
{
long int length;
sexpSimpleString *ss;
@@ -475,8 +446,7 @@ sexpInputStream *is; /* scanString(is)
* Reads and returns a string [presentationhint]string from input stream.
*/
-sexpString *scanString(is)
-sexpInputStream *is;
+sexpString *scanString(sexpInputStream *is)
{
sexpString *s;
sexpSimpleString *ss;
@@ -499,8 +469,7 @@ sexpInputStream *is; /* scanList(is)
* Read and return a sexpList from the input stream.
*/
-sexpList *scanList(is)
-sexpInputStream *is;
+sexpList *scanList(sexpInputStream *is)
{ sexpList *list;
sexpObject *object;
skipChar(is,'(');
@@ -532,8 +501,7 @@ sexpInputStream *is; /* scanObject(is)
* Reads and returns a sexpObject from the given input stream.
*/
-sexpObject *scanObject(is)
-sexpInputStream *is;
+sexpObject *scanObject(sexpInputStream *is)
{
sexpObject *object;
skipWhiteSpace(is);
diff --git a/rpmio/sexp/sexp-main.c b/rpmio/sexp/sexp-main.c index 560a45506..c9071c7af 100644 --- a/rpmio/sexp/sexp-main.c +++ b/rpmio/sexp/sexp-main.c @@ -38,9 +38,7 @@ char *help = /*************************************************************************/
/* main(argc,argv)
*/
-int main(argc,argv)
-int argc;
-char **argv;
+int main(int argc, char **argv)
{ char *c;
int swa = TRUE;
int swb = TRUE;
diff --git a/rpmio/sexp/sexp-output.c b/rpmio/sexp/sexp-output.c index c0c91e727..3ae20b250 100644 --- a/rpmio/sexp/sexp-output.c +++ b/rpmio/sexp/sexp-output.c @@ -20,9 +20,7 @@ static char *base64Digits = * Puts the character c out on the output stream os.
* Keeps track of the "column" the next output char will go to.
*/
-void putChar(os,c)
-sexpOutputStream *os;
-int c;
+void putChar(sexpOutputStream *os, int c)
{
putc(c,os->outputFile);
os->column++;
@@ -31,9 +29,7 @@ int c; /* varPutChar(os,c)
* putChar with variable sized output bytes considered.
*/
-void varPutChar(os,c)
-sexpOutputStream *os;
-int c; /* this is always an eight-bit byte being output */
+void varPutChar(sexpOutputStream *os, int c)
{
c &= 0xFF;
os->bits = (os->bits << 8) | c;
@@ -62,10 +58,7 @@ int c; /* this is always an eight-bit byte being output */ * Change os->byteSize to newByteSize
* record mode in output stream for automatic line breaks
*/
-void changeOutputByteSize(os,newByteSize,mode)
-sexpOutputStream *os;
-int newByteSize;
-int mode;
+void changeOutputByteSize(sexpOutputStream *os, int newByteSize, int mode)
{
if (newByteSize != 4 && newByteSize !=6 && newByteSize !=8)
ErrorMessage(ERROR,"Illegal output base %d.",newByteSize,0);
@@ -82,8 +75,7 @@ int mode; /* flushOutput(os)
* flush out any remaining bits
*/
-void flushOutput(os)
-sexpOutputStream *os;
+void flushOutput(sexpOutputStream * os)
{ if (os->nBits > 0)
{
if (os->byteSize == 4)
@@ -110,9 +102,7 @@ sexpOutputStream *os; * indentation level (but never indents more than half of maxcolumn).
* Resets column for next output character.
*/
-void newLine(os,mode)
-sexpOutputStream *os;
-int mode;
+void newLine(sexpOutputStream *os, int mode)
{ int i;
if (mode == ADVANCED || mode == BASE64)
{ os->putChar(os,'\n');
@@ -126,7 +116,7 @@ int mode; /* newSexpOutputStream()
* Creates and initializes new sexpOutputStream object.
*/
-sexpOutputStream *newSexpOutputStream()
+sexpOutputStream *newSexpOutputStream(void)
{
sexpOutputStream *os;
os = (sexpOutputStream *) sexpAlloc(sizeof(sexpOutputStream));
@@ -150,9 +140,7 @@ sexpOutputStream *newSexpOutputStream() /* printDecimal(os,n)
* print out n in decimal to output stream os
*/
-void printDecimal(os,n)
-sexpOutputStream *os;
-long int n;
+void printDecimal(sexpOutputStream *os, long int n)
{ char buffer[50];
int i;
sprintf(buffer,"%ld",n);
@@ -167,9 +155,7 @@ long int n; /* canonicalPrintVerbatimSimpleString(os,ss)
* Print out simple string ss on output stream os as verbatim string.
*/
-void canonicalPrintVerbatimSimpleString(os,ss)
-sexpOutputStream *os;
-sexpSimpleString *ss;
+void canonicalPrintVerbatimSimpleString(sexpOutputStream *os, sexpSimpleString *ss)
{
long int len;
long int i;
@@ -188,9 +174,7 @@ sexpSimpleString *ss; /* canonicalPrintString(os,s)
* Prints out sexp string s onto output stream os
*/
-void canonicalPrintString(os,s)
-sexpOutputStream *os;
-sexpString *s;
+void canonicalPrintString(sexpOutputStream *os, sexpString *s)
{ sexpSimpleString *ph, *ss;
ph = sexpStringPresentationHint(s);
if (ph != NULL)
@@ -207,9 +191,7 @@ sexpString *s; /* canonicalPrintList(os,list)
* Prints out the list "list" onto output stream os
*/
-void canonicalPrintList(os,list)
-sexpOutputStream *os;
-sexpList *list;
+void canonicalPrintList(sexpOutputStream *os, sexpList *list)
{ sexpIter *iter;
sexpObject *object;
varPutChar(os,'(');
@@ -227,9 +209,7 @@ sexpList *list; * Prints out object on output stream os
* Note that this uses the common "type" field of lists and strings.
*/
-void canonicalPrintObject(os,object)
-sexpOutputStream *os;
-sexpObject *object;
+void canonicalPrintObject(sexpOutputStream *os, sexpObject *object)
{
if (isObjectString(object))
canonicalPrintString(os,(sexpString *)object);
@@ -243,9 +223,7 @@ sexpObject *object; /* *************/
/* Same as canonical, except all characters get put out as base 64 ones */
-void base64PrintWholeObject(os,object)
-sexpOutputStream *os;
-sexpObject *object;
+void base64PrintWholeObject(sexpOutputStream *os, sexpObject *object)
{
changeOutputByteSize(os,8,BASE64);
varPutChar(os,'{');
@@ -266,9 +244,7 @@ sexpObject *object; * Returns TRUE if simple string ss can be printed as a token.
* Doesn't begin with a digit, and all characters are tokenchars.
*/
-int canPrintAsToken(os,ss)
-sexpOutputStream *os;
-sexpSimpleString *ss;
+int canPrintAsToken(sexpOutputStream *os, sexpSimpleString *ss)
{
int i;
octet *c;
@@ -288,9 +264,7 @@ sexpSimpleString *ss; * Prints out simple string ss as a token (assumes that this is OK).
* May run over max-column, but there is no fragmentation allowed...
*/
-void advancedPrintTokenSimpleString(os,ss)
-sexpOutputStream *os;
-sexpSimpleString *ss;
+void advancedPrintTokenSimpleString(sexpOutputStream *os, sexpSimpleString *ss)
{ int i;
long int len;
octet *c;
@@ -305,8 +279,7 @@ sexpSimpleString *ss; /* advancedLengthSimpleStringToken(ss)
* Returns length for printing simple string ss as a token
*/
-int advancedLengthSimpleStringToken(ss)
-sexpSimpleString *ss;
+int advancedLengthSimpleStringToken(sexpSimpleString *ss)
{ return(simpleStringLength(ss)); }
@@ -316,9 +289,7 @@ sexpSimpleString *ss; * Print out simple string ss on output stream os as verbatim string.
* Again, can't fragment string, so max-column is just a suggestion...
*/
-void advancedPrintVerbatimSimpleString(os,ss)
-sexpOutputStream *os;
-sexpSimpleString *ss;
+void advancedPrintVerbatimSimpleString(sexpOutputStream *os, sexpSimpleString *ss)
{
long int len = simpleStringLength(ss);
long int i;
@@ -336,8 +307,7 @@ sexpSimpleString *ss; /* advancedLengthSimpleStringVerbatim(ss)
* Returns length for printing simple string ss in verbatim mode
*/
-int advancedLengthSimpleStringVerbatim(ss)
-sexpSimpleString *ss;
+int advancedLengthSimpleStringVerbatim(sexpSimpleString *ss)
{ long int len = simpleStringLength(ss);
int i = 1;
while (len > 9L) { i++; len = len / 10; }
@@ -349,9 +319,7 @@ sexpSimpleString *ss; /* advancedPrintBase64SimpleString(os,ss)
* Prints out simple string ss as a base64 value.
*/
-void advancedPrintBase64SimpleString(os,ss)
-sexpOutputStream *os;
-sexpSimpleString *ss;
+void advancedPrintBase64SimpleString(sexpOutputStream *os, sexpSimpleString *ss)
{
long int i,len;
octet *c = simpleStringString(ss);
@@ -372,9 +340,7 @@ sexpSimpleString *ss; /* advancedPrintHexSimpleString(os,ss)
* Prints out simple string ss as a hexadecimal value.
*/
-void advancedPrintHexSimpleString(os,ss)
-sexpOutputStream *os;
-sexpSimpleString *ss;
+void advancedPrintHexSimpleString(sexpOutputStream *os, sexpSimpleString *ss)
{
long int i,len;
octet *c = simpleStringString(ss);
@@ -393,8 +359,7 @@ sexpSimpleString *ss; /* advancedLengthSimpleStringHexadecimal(ss)
* Returns length for printing simple string ss in hexadecimal mode
*/
-int advancedLengthSimpleStringHexadecimal(ss)
-sexpSimpleString *ss;
+int advancedLengthSimpleStringHexadecimal(sexpSimpleString *ss)
{ long int len = simpleStringLength(ss);
return(1+2*len+1);
}
@@ -405,8 +370,7 @@ sexpSimpleString *ss; * Returns TRUE if simple string ss can be printed as a quoted string.
* Must have only tokenchars and blanks.
*/
-int canPrintAsQuotedString(ss)
-sexpSimpleString *ss;
+int canPrintAsQuotedString(sexpSimpleString *ss)
{
long int i, len;
octet *c = simpleStringString(ss);
@@ -424,9 +388,7 @@ sexpSimpleString *ss; * so no escape sequences need to be generated.
* May run over max-column, but there is no fragmentation allowed...
*/
-void advancedPrintQuotedStringSimpleString(os,ss)
-sexpOutputStream *os;
-sexpSimpleString *ss;
+void advancedPrintQuotedStringSimpleString(sexpOutputStream *os, sexpSimpleString *ss)
{ long int i;
long int len = simpleStringLength(ss);
octet *c = simpleStringString(ss);
@@ -446,8 +408,7 @@ sexpSimpleString *ss; /* advancedLengthSimpleStringQuotedString(ss)
* Returns length for printing simple string ss in quoted-string mode
*/
-int advancedLengthSimpleStringQuotedString(ss)
-sexpSimpleString *ss;
+int advancedLengthSimpleStringQuotedString(sexpSimpleString *ss)
{ long int len = simpleStringLength(ss);
return(1+len+1);
}
@@ -457,9 +418,7 @@ sexpSimpleString *ss; /* advancedPrintSimpleString(os,ss)
* Prints out simple string ss onto output stream ss
*/
-void advancedPrintSimpleString(os,ss)
-sexpOutputStream *os;
-sexpSimpleString *ss;
+void advancedPrintSimpleString(sexpOutputStream *os, sexpSimpleString *ss)
{ long int len = simpleStringLength(ss);
if (canPrintAsToken(os,ss))
advancedPrintTokenSimpleString(os,ss);
@@ -476,9 +435,7 @@ sexpSimpleString *ss; /* advancedPrintString(os,s)
* Prints out sexp string s onto output stream os
*/
-void advancedPrintString(os,s)
-sexpOutputStream *os;
-sexpString *s;
+void advancedPrintString(sexpOutputStream *os, sexpString *s)
{
sexpSimpleString *ph = sexpStringPresentationHint(s);
sexpSimpleString *ss = sexpStringString(s);
@@ -495,16 +452,13 @@ sexpString *s; /* advancedLengthSimpleStringBase64(ss)
* Returns length for printing simple string ss as a base64 string
*/
-int advancedLengthSimpleStringBase64(ss)
-sexpSimpleString *ss;
+int advancedLengthSimpleStringBase64(sexpSimpleString *ss)
{ return(2+4*((simpleStringLength(ss)+2)/3)); }
/* advancedLengthSimpleString(os,ss)
* Returns length of printed image of s
*/
-int advancedLengthSimpleString(os,ss)
-sexpOutputStream *os;
-sexpSimpleString *ss;
+int advancedLengthSimpleString(sexpOutputStream *os, sexpSimpleString *ss)
{ long int len = simpleStringLength(ss);
if (canPrintAsToken(os,ss))
return(advancedLengthSimpleStringToken(ss));
@@ -521,9 +475,7 @@ sexpSimpleString *ss; /* advancedLengthString(os,s)
* Returns length of printed image of string s
*/
-int advancedLengthString(os,s)
-sexpOutputStream *os;
-sexpString *s;
+int advancedLengthString(sexpOutputStream *os, sexpString *s)
{ int len = 0;
sexpSimpleString *ph = sexpStringPresentationHint(s);
sexpSimpleString *ss = sexpStringString(s);
@@ -537,9 +489,7 @@ sexpString *s; /* advancedLengthList(os,list)
* Returns length of printed image of list given as iterator
*/
-int advancedLengthList(os,list)
-sexpOutputStream *os;
-sexpList *list;
+int advancedLengthList(sexpOutputStream *os, sexpList *list)
{ int len = 1; /* for left paren */
sexpIter *iter;
sexpObject *object;
@@ -566,9 +516,7 @@ sexpList *list; * written out in "vertical" mode, with items of the list starting in
* the same column on successive lines.
*/
-void advancedPrintList(os,list)
-sexpOutputStream *os;
-sexpList *list;
+void advancedPrintList(sexpOutputStream *os, sexpList *list)
{ int vertical = FALSE;
int firstelement = TRUE;
sexpIter *iter;
@@ -599,9 +547,7 @@ sexpList *list; /* advancedPrintObject(os,object)
* Prints out object on output stream os
*/
-void advancedPrintObject(os,object)
-sexpOutputStream *os;
-sexpObject *object;
+void advancedPrintObject(sexpOutputStream *os, sexpObject *object)
{
if (os->maxcolumn>0 && os->column>os->maxcolumn-4)
os->newLine(os,ADVANCED);
diff --git a/rpmio/sexp/sexp.h b/rpmio/sexp/sexp.h index 413be2f54..10f7a060c 100644 --- a/rpmio/sexp/sexp.h +++ b/rpmio/sexp/sexp.h @@ -86,82 +86,159 @@ typedef struct sexp_outputstream { /* Function prototypes */
/* sexp-basic */
-void ErrorMessage();
-void initializeMemory();
-char *sexpAlloc();
-sexpSimpleString *newSimpleString();
-long int simpleStringLength();
-octet *simpleStringString();
-sexpSimpleString *reallocateSimpleString();
-void appendCharToSimpleString();
-sexpString *newSexpString();
-sexpSimpleString *sexpStringPresentationHint();
-sexpSimpleString *sexpStringString();
-void setSexpStringPresentationHint();
-void setSexpStringString();
-void closeSexpString();
-sexpList *newSexpList();
-void sexpAddSexpListObject();
-void closeSexpList();
-sexpIter *sexpListIter();
-sexpIter *sexpIterNext();
-sexpObject *sexpIterObject();
-int isObjectString();
-int isObjectList();
+void ErrorMessage(int level, const char *msg, int c1, int c2)
+ /*@*/;
+void initializeMemory(void)
+ /*@*/;
+char *sexpAlloc(int n)
+ /*@*/;
+sexpSimpleString *newSimpleString(void)
+ /*@*/;
+long int simpleStringLength(sexpSimpleString *ss)
+ /*@*/;
+octet *simpleStringString(sexpSimpleString *ss)
+ /*@*/;
+sexpSimpleString *reallocateSimpleString(sexpSimpleString *ss)
+ /*@*/;
+void appendCharToSimpleString(int c, sexpSimpleString *ss)
+ /*@*/;
+sexpString *newSexpString(void)
+ /*@*/;
+sexpSimpleString *sexpStringPresentationHint(sexpString *s)
+ /*@*/;
+void setSexpStringPresentationHint(sexpString *s, sexpSimpleString *ss)
+ /*@*/;
+void setSexpStringString(sexpString *s, sexpSimpleString *ss)
+ /*@*/;
+sexpSimpleString *sexpStringString(sexpString *s)
+ /*@*/;
+void closeSexpString(sexpString *s)
+ /*@*/;
+sexpList *newSexpList(void)
+ /*@*/;
+void sexpAddSexpListObject(sexpList *list, sexpObject *object)
+ /*@*/;
+void closeSexpList(sexpList *list)
+ /*@*/;
+sexpIter *sexpListIter(sexpList *list)
+ /*@*/;
+sexpIter *sexpIterNext(sexpIter *iter)
+ /*@*/;
+sexpObject *sexpIterObject(sexpIter *iter)
+ /*@*/;
+int isObjectString(sexpObject *object)
+ /*@*/;
+int isObjectList(sexpObject *object)
+ /*@*/;
/* sexp-input */
-void initializeCharacterTables();
-int isWhiteSpace();
-int isDecDigit();
-int isHexDigit();
-int isBase64Digit();
-int isTokenChar();
-int isAlpha();
-void changeInputByteSize();
-void getChar();
-sexpInputStream *newSexpInputStream();
-void skipWhiteSpace();
-void skipChar();
-void scanToken();
-sexpObject *scanToEOF();
-unsigned long int scanDecimal();
-void scanVerbatimString();
-void scanQuotedString();
-void scanHexString();
-void scanBase64String();
-sexpSimpleString *scanSimpleString();
-sexpString *scanString();
-sexpList *scanList();
-sexpObject *scanObject();
+void initializeCharacterTables(void)
+ /*@*/;
+int isWhiteSpace(int c)
+ /*@*/;
+int isDecDigit(int c)
+ /*@*/;
+int isHexDigit(int c)
+ /*@*/;
+int isBase64Digit(int c)
+ /*@*/;
+int isTokenChar(int c)
+ /*@*/;
+int isAlpha(int c)
+ /*@*/;
+void changeInputByteSize(sexpInputStream *is, int newByteSize)
+ /*@*/;
+void getChar(sexpInputStream *is)
+ /*@*/;
+sexpInputStream *newSexpInputStream(void)
+ /*@*/;
+void skipWhiteSpace(sexpInputStream *is)
+ /*@*/;
+void skipChar(sexpInputStream *is, int c)
+ /*@*/;
+void scanToken(sexpInputStream *is, sexpSimpleString *ss)
+ /*@*/;
+sexpObject *scanToEOF(sexpInputStream *is)
+ /*@*/;
+unsigned long int scanDecimal(sexpInputStream *is)
+ /*@*/;
+void scanVerbatimString(sexpInputStream *is, sexpSimpleString *ss, long int length)
+ /*@*/;
+void scanQuotedString(sexpInputStream *is, sexpSimpleString *ss, long int length)
+ /*@*/;
+void scanHexString(sexpInputStream *is, sexpSimpleString *ss, long int length)
+ /*@*/;
+void scanBase64String(sexpInputStream *is, sexpSimpleString *ss, long int length)
+ /*@*/;
+sexpSimpleString *scanSimpleString(sexpInputStream *is)
+ /*@*/;
+sexpString *scanString(sexpInputStream *is)
+ /*@*/;
+sexpList *scanList(sexpInputStream *is)
+ /*@*/;
+sexpObject *scanObject(sexpInputStream *is)
+ /*@*/;
/* sexp-output */
-void putChar();
-void varPutChar();
-void changeOutputByteSize();
-void flushOutput();
-void newLine();
-sexpOutputStream *newSexpOutputStream();
-void printDecimal();
-void canonicalPrintVerbatimSimpleString();
-void canonicalPrintString();
-void canonicalPrintList();
-void canonicalPrintObject();
-void base64PrintWholeObject();
-int canPrintAsToken();
-int significantNibbles();
-void advancedPrintTokenSimpleString();
-int advancedLengthSimpleStringToken();
-void advancedPrintVerbatimSimpleString();
-int advancedLengthSimpleStringVerbatim();
-void advancedPrintBase64SimpleString();
-void advancedPrintHexSimpleString();
-int canPrintAsQuotedString();
-void advancedPrintQuotedStringSimpleString();
-void advancedPrintSimpleString();
-void advancedPrintString();
-int advancedLengthSimpleStringBase64();
-int advancedLengthSimpleString();
-int advancedLengthString();
-int advancedLengthList();
-void advancedPrintList();
-void advancedPrintObject();
+void putChar(sexpOutputStream *os, int c)
+ /*@*/;
+void varPutChar(sexpOutputStream *os, int c)
+ /*@*/;
+void changeOutputByteSize(sexpOutputStream *os, int newByteSize, int mode)
+ /*@*/;
+void flushOutput(sexpOutputStream * os)
+ /*@*/;
+void newLine(sexpOutputStream *os, int mode)
+ /*@*/;
+sexpOutputStream *newSexpOutputStream(void)
+ /*@*/;
+void printDecimal(sexpOutputStream *os, long int n)
+ /*@*/;
+void canonicalPrintVerbatimSimpleString(sexpOutputStream *os, sexpSimpleString *ss)
+ /*@*/;
+void canonicalPrintString(sexpOutputStream *os, sexpString *s)
+ /*@*/;
+void canonicalPrintList(sexpOutputStream *os, sexpList *list)
+ /*@*/;
+void canonicalPrintObject(sexpOutputStream *os, sexpObject *object)
+ /*@*/;
+void base64PrintWholeObject(sexpOutputStream *os, sexpObject *object)
+ /*@*/;
+int canPrintAsToken(sexpOutputStream *os, sexpSimpleString *ss)
+ /*@*/;
+void advancedPrintTokenSimpleString(sexpOutputStream *os, sexpSimpleString *ss)
+ /*@*/;
+int advancedLengthSimpleStringToken(sexpSimpleString *ss)
+ /*@*/;
+void advancedPrintVerbatimSimpleString(sexpOutputStream *os, sexpSimpleString *ss)
+ /*@*/;
+int advancedLengthSimpleStringVerbatim(sexpSimpleString *ss)
+ /*@*/;
+void advancedPrintBase64SimpleString(sexpOutputStream *os, sexpSimpleString *ss)
+ /*@*/;
+void advancedPrintHexSimpleString(sexpOutputStream *os, sexpSimpleString *ss)
+ /*@*/;
+int advancedLengthSimpleStringHexadecimal(sexpSimpleString *ss)
+ /*@*/;
+int canPrintAsQuotedString(sexpSimpleString *ss)
+ /*@*/;
+void advancedPrintQuotedStringSimpleString(sexpOutputStream *os, sexpSimpleString *ss)
+ /*@*/;
+int advancedLengthSimpleStringQuotedString(sexpSimpleString *ss)
+ /*@*/;
+void advancedPrintSimpleString(sexpOutputStream *os, sexpSimpleString *ss)
+ /*@*/;
+void advancedPrintString(sexpOutputStream *os, sexpString *s)
+ /*@*/;
+int advancedLengthSimpleStringBase64(sexpSimpleString *ss)
+ /*@*/;
+int advancedLengthSimpleString(sexpOutputStream *os, sexpSimpleString *ss)
+ /*@*/;
+int advancedLengthString(sexpOutputStream *os, sexpString *s)
+ /*@*/;
+int advancedLengthList(sexpOutputStream *os, sexpList *list)
+ /*@*/;
+void advancedPrintList(sexpOutputStream *os, sexpList *list)
+ /*@*/;
+void advancedPrintObject(sexpOutputStream *os, sexpObject *object)
+ /*@*/;
|