# lib/hdrinline.h

Go to the documentation of this file.

    00001 /*@-type@*/ /* FIX: cast to HV_t bogus */
    00002 #ifndef H_HDRINLINE
    00003 #define H_HDRINLINE
    00004
    00009 #ifdef __cplusplus
    00010 extern "C" {
    00011 #endif
    00012 /*@+voidabstract -nullpass -mustmod -compdef -shadow -predboolothers @*/
    00013
    00017 /*@observer@*/ /*@unchecked@*/
    00018 extern struct HV_s * hdrVec;
    00019
    00022 /*@unused@*/ static inline HV_t h2hv(Header h)
    00023         /*@*/
    00024 {
    00025     /*@-abstract -castexpose -refcounttrans@*/
    00026     return ((HV_t)h);
    00027     /*@=abstract =castexpose =refcounttrans@*/
    00028 }
    00029
    00034 /*@unused@*/ static inline
    00035 Header headerNew(void)
    00036         /*@*/
    00037 {
    00038     return hdrVec->hdrnew();
    00039 }
    00040
    00046 /*@unused@*/ static inline
    00047 /*@null@*/ Header headerFree( /*@null@*/ /*@killref@*/ Header h)
    00048         /*@modifies h @*/
    00049 {
    00050     /*@-abstract@*/
    00051     if (h == NULL) return NULL;
    00052     /*@=abstract@*/
    00053     return (h2hv(h)->hdrfree) (h);
    00054 }
    00055
    00061 /*@unused@*/ static inline
    00062 Header headerLink(Header h)
    00063         /*@modifies h @*/
    00064 {
    00065     return (h2hv(h)->hdrlink) (h);
    00066 }
    00067
    00073 /*@unused@*/ static inline
    00074 Header headerUnlink(/*@killref@*/ /*@null@*/ Header h)
    00075         /*@modifies h @*/
    00076 {
    00077     /*@-abstract@*/
    00078     if (h == NULL) return NULL;
    00079     /*@=abstract@*/
    00080     return (h2hv(h)->hdrunlink) (h);
    00081 }
    00082
    00083 /*@-exportlocal@*/
    00088 /*@unused@*/ static inline
    00089 void headerSort(Header h)
    00090         /*@modifies h @*/
    00091 {
    00092 /*@-noeffectuncon@*/ /* FIX: add rc */
    00093     (h2hv(h)->hdrsort) (h);
    00094 /*@=noeffectuncon@*/
    00095     return;
    00096 }
    00097
    00102 /*@unused@*/ static inline
    00103 void headerUnsort(Header h)
    00104         /*@modifies h @*/
    00105 {
    00106 /*@-noeffectuncon@*/ /* FIX: add rc */
    00107     (h2hv(h)->hdrunsort) (h);
    00108 /*@=noeffectuncon@*/
    00109     return;
    00110 }
    00111 /*@=exportlocal@*/
    00112
    00119 /*@unused@*/ static inline
    00120 unsigned int headerSizeof(/*@null@*/ Header h, enum hMagic magicp)
    00121         /*@modifies h @*/
    00122 {
    00123     /*@-abstract@*/
    00124     if (h == NULL) return 0;
    00125     /*@=abstract@*/
    00126     return (h2hv(h)->hdrsizeof) (h, magicp);
    00127 }
    00128
    00134 /*@unused@*/ static inline
    00135 /*@only@*/ /*@null@*/ void * headerUnload(Header h)
    00136         /*@modifies h @*/
    00137 {
    00138     return (h2hv(h)->hdrunload) (h);
    00139 }
    00140
    00148 /*@unused@*/ static inline
    00149 /*@null@*/ Header headerReload(/*@only@*/ Header h, int tag)
    00150         /*@modifies h @*/
    00151 {
    00152     /*@-onlytrans@*/
    00153     return (h2hv(h)->hdrreload) (h, tag);
    00154     /*@=onlytrans@*/
    00155 }
    00156
    00162 /*@unused@*/ static inline
    00163 /*@null@*/ Header headerCopy(Header h)
    00164         /*@modifies h @*/
    00165 {
    00166     return (h2hv(h)->hdrcopy) (h);
    00167 }
    00168
    00174 /*@unused@*/ static inline
    00175 /*@null@*/ Header headerLoad(/*@kept@*/ void * uh)
    00176         /*@modifies uh @*/
    00177 {
    00178     return hdrVec->hdrload(uh);
    00179 }
    00180
    00186 /*@unused@*/ static inline
    00187 /*@null@*/ Header headerCopyLoad(const void * uh)
    00188         /*@*/
    00189 {
    00190     return hdrVec->hdrcopyload(uh);
    00191 }
    00192
    00199 /*@unused@*/ static inline
    00200 /*@null@*/ Header headerRead(FD_t fd, enum hMagic magicp)
    00201         /*@modifies fd @*/
    00202 {
    00203     return hdrVec->hdrread(fd, magicp);
    00204 }
    00205
    00213 /*@unused@*/ static inline
    00214 int headerWrite(FD_t fd, /*@null@*/ Header h, enum hMagic magicp)
    00215         /*@modifies fd, h @*/
    00216 {
    00217     /*@-abstract@*/
    00218     if (h == NULL) return 0;
    00219     /*@=abstract@*/
    00220     return (h2hv(h)->hdrwrite) (fd, h, magicp);
    00221 }
    00222
    00229 /*@unused@*/ static inline
    00230 int headerIsEntry(/*@null@*/ Header h, int_32 tag)
    00231         /*@modifies h @*/
    00232 {
    00233     /*@-abstract@*/
    00234     if (h == NULL) return 0;
    00235     /*@=abstract@*/
    00236     return (h2hv(h)->hdrisentry) (h, tag);
    00237 }
    00238
    00246 /*@unused@*/ static inline
    00247 /*@null@*/ void * headerFreeTag(Header h,
    00248                 /*@only@*/ /*@null@*/ const void * data, rpmTagType type)
    00249         /*@modifies data @*/
    00250 {
    00251     return (h2hv(h)->hdrfreetag) (h, data, type);
    00252 }
    00253
    00267 /*@unused@*/ static inline
    00268 int headerGetEntry(Header h, int_32 tag,
    00269                         /*@null@*/ /*@out@*/ hTYP_t type,
    00270                         /*@null@*/ /*@out@*/ void ** p,
    00271                         /*@null@*/ /*@out@*/ hCNT_t c)
    00272         /*@modifies *type, *p, *c @*/
    00273 {
    00274     return (h2hv(h)->hdrget) (h, tag, type, p, c);
    00275 }
    00276
    00289 /*@unused@*/ static inline
    00290 int headerGetEntryMinMemory(Header h, int_32 tag,
    00291                         /*@null@*/ /*@out@*/ hTYP_t type,
    00292                         /*@null@*/ /*@out@*/ hPTR_t * p,
    00293                         /*@null@*/ /*@out@*/ hCNT_t c)
    00294         /*@modifies *type, *p, *c @*/
    00295 {
    00296     return (h2hv(h)->hdrgetmin) (h, tag, type, p, c);
    00297 }
    00298
    00313 /*@mayexit@*/
    00314 /*@unused@*/ static inline
    00315 int headerAddEntry(Header h, int_32 tag, int_32 type, const void * p, int_32 c)
    00316         /*@modifies h @*/
    00317 {
    00318     return (h2hv(h)->hdradd) (h, tag, type, p, c);
    00319 }
    00320
    00335 /*@unused@*/ static inline
    00336 int headerAppendEntry(Header h, int_32 tag, int_32 type,
    00337                 const void * p, int_32 c)
    00338         /*@modifies h @*/
    00339 {
    00340     return (h2hv(h)->hdrappend) (h, tag, type, p, c);
    00341 }
    00342
    00353 /*@unused@*/ static inline
    00354 int headerAddOrAppendEntry(Header h, int_32 tag, int_32 type,
    00355                 const void * p, int_32 c)
    00356         /*@modifies h @*/
    00357 {
    00358     return (h2hv(h)->hdraddorappend) (h, tag, type, p, c);
    00359 }
    00360
    00381 /*@unused@*/ static inline
    00382 int headerAddI18NString(Header h, int_32 tag, const char * string,
    00383                 const char * lang)
    00384         /*@modifies h @*/
    00385 {
    00386     return (h2hv(h)->hdraddi18n) (h, tag, string, lang);
    00387 }
    00388
    00399 /*@unused@*/ static inline
    00400 int headerModifyEntry(Header h, int_32 tag, int_32 type,
    00401                         const void * p, int_32 c)
    00402         /*@modifies h @*/
    00403 {
    00404     return (h2hv(h)->hdrmodify) (h, tag, type, p, c);
    00405 }
    00406
    00416 /*@unused@*/ static inline
    00417 int headerRemoveEntry(Header h, int_32 tag)
    00418         /*@modifies h @*/
    00419 {
    00420     return (h2hv(h)->hdrremove) (h, tag);
    00421 }
    00422
    00434 /*@unused@*/ static inline
    00435 /*@only@*/ char * headerSprintf(Header h, const char * fmt,
    00436                      const struct headerTagTableEntry_s * tbltags,
    00437                      const struct headerSprintfExtension_s * extensions,
    00438                      /*@null@*/ /*@out@*/ errmsg_t * errmsg)
    00439         /*@modifies *errmsg @*/
    00440 {
    00441     return (h2hv(h)->hdrsprintf) (h, fmt, tbltags, extensions, errmsg);
    00442 }
    00443
    00450 /*@unused@*/ static inline
    00451 void headerCopyTags(Header headerFrom, Header headerTo, hTAG_t tagstocopy)
    00452         /*@modifies headerFrom, headerTo @*/
    00453 {
    00454 /*@-noeffectuncon@*/ /* FIX: add rc */
    00455     hdrVec->hdrcopytags(headerFrom, headerTo, tagstocopy);
    00456 /*@=noeffectuncon@*/
    00457     return;
    00458 }
    00459
    00465 /*@unused@*/ static inline
    00466 HeaderIterator headerFreeIterator(/*@only@*/ HeaderIterator hi)
    00467         /*@modifies hi @*/
    00468 {
    00469     return hdrVec->hdrfreeiter(hi);
    00470 }
    00471
    00477 /*@unused@*/ static inline
    00478 HeaderIterator headerInitIterator(Header h)
    00479         /*@modifies h */
    00480 {
    00481     return hdrVec->hdrinititer(h);
    00482 }
    00483
    00493 /*@unused@*/ static inline
    00494 int headerNextIterator(HeaderIterator hi,
    00495                 /*@null@*/ /*@out@*/ hTAG_t tag,
    00496                 /*@null@*/ /*@out@*/ hTYP_t type,
    00497                 /*@null@*/ /*@out@*/ hPTR_t * p,
    00498                 /*@null@*/ /*@out@*/ hCNT_t c)
    00499         /*@modifies hi, *tag, *type, *p, *c @*/
    00500 {
    00501     return hdrVec->hdrnextiter(hi, tag, type, p, c);
    00502 }
    00503
    00504 /*@=voidabstract =nullpass =mustmod =compdef =shadow =predboolothers @*/
    00505
    00506 #ifdef __cplusplus
    00507 }
    00508 #endif
    00509
    00510 #endif  /* H_HDRINLINE */
    00511 /*@=type@*/