rpm  4.5
hdrinline.h
Go to the documentation of this file.
1 /*@-type@*/ /* FIX: cast to HV_t bogus */
2 #ifndef H_HDRINLINE
3 #define H_HDRINLINE
4 
9 #ifdef __cplusplus
10 extern "C" {
11 #endif
12 /*@+voidabstract -nullpass -mustmod -compdef -shadow -predboolothers @*/
13 
17 /*@observer@*/ /*@unchecked@*/
18 extern struct HV_s * hdrVec;
19 
22 /*@unused@*/ static inline HV_t h2hv(Header h)
23  /*@*/
24 {
25  /*@-abstract -castexpose -refcounttrans@*/
26  return ((HV_t)h);
27  /*@=abstract =castexpose =refcounttrans@*/
28 }
29 
34 /*@unused@*/ static inline
36  /*@*/
37 {
38  return hdrVec->hdrnew();
39 }
40 
46 /*@unused@*/ static inline
47 /*@null@*/ Header headerFree( /*@killref@*/ /*@null@*/ Header h)
48  /*@modifies h @*/
49 {
50  /*@-abstract@*/
51  if (h == NULL) return NULL;
52  /*@=abstract@*/
53  return (h2hv(h)->hdrfree) (h);
54 }
55 
61 /*@unused@*/ static inline
63  /*@modifies h @*/
64 {
65  return (h2hv(h)->hdrlink) (h);
66 }
67 
73 /*@unused@*/ static inline
74 Header headerUnlink(/*@killref@*/ /*@null@*/ Header h)
75  /*@modifies h @*/
76 {
77  /*@-abstract@*/
78  if (h == NULL) return NULL;
79  /*@=abstract@*/
80  return (h2hv(h)->hdrunlink) (h);
81 }
82 
83 /*@-exportlocal@*/
88 /*@unused@*/ static inline
90  /*@modifies h @*/
91 {
92 /*@-noeffectuncon@*/ /* FIX: add rc */
93  (h2hv(h)->hdrsort) (h);
94 /*@=noeffectuncon@*/
95  return;
96 }
97 
102 /*@unused@*/ static inline
104  /*@modifies h @*/
105 {
106 /*@-noeffectuncon@*/ /* FIX: add rc */
107  (h2hv(h)->hdrunsort) (h);
108 /*@=noeffectuncon@*/
109  return;
110 }
111 /*@=exportlocal@*/
112 
119 /*@unused@*/ static inline
120 unsigned int headerSizeof(/*@null@*/ Header h, enum hMagic magicp)
121  /*@modifies h @*/
122 {
123  /*@-abstract@*/
124  if (h == NULL) return 0;
125  /*@=abstract@*/
126  return (h2hv(h)->hdrsizeof) (h, magicp);
127 }
128 
134 /*@unused@*/ static inline
135 /*@only@*/ /*@null@*/ void * headerUnload(Header h)
136  /*@modifies h @*/
137 {
138  return (h2hv(h)->hdrunload) (h);
139 }
140 
148 /*@unused@*/ static inline
149 /*@null@*/ Header headerReload(/*@only@*/ Header h, int tag)
150  /*@modifies h @*/
151 {
152  /*@-onlytrans@*/
153  return (h2hv(h)->hdrreload) (h, tag);
154  /*@=onlytrans@*/
155 }
156 
162 /*@unused@*/ static inline
163 /*@null@*/ Header headerCopy(Header h)
164  /*@modifies h @*/
165 {
166  return (h2hv(h)->hdrcopy) (h);
167 }
168 
174 /*@unused@*/ static inline
175 /*@null@*/ Header headerLoad(/*@kept@*/ void * uh)
176  /*@modifies uh @*/
177 {
178  return hdrVec->hdrload(uh);
179 }
180 
186 /*@unused@*/ static inline
187 /*@null@*/ Header headerCopyLoad(const void * uh)
188  /*@*/
189 {
190  return hdrVec->hdrcopyload(uh);
191 }
192 
199 /*@unused@*/ static inline
200 /*@null@*/ Header headerRead(void * _fd, enum hMagic magicp)
201  /*@modifies _fd @*/
202 {
203  return hdrVec->hdrread(_fd, magicp);
204 }
205 
213 /*@unused@*/ static inline
214 int headerWrite(void * _fd, /*@null@*/ Header h, enum hMagic magicp)
215  /*@modifies _fd, h @*/
216 {
217  /*@-abstract@*/
218  if (h == NULL) return 0;
219  /*@=abstract@*/
220  return (h2hv(h)->hdrwrite) (_fd, h, magicp);
221 }
222 
229 /*@unused@*/ static inline
230 int headerIsEntry(/*@null@*/ Header h, int_32 tag)
231  /*@modifies h @*/
232 {
233  /*@-abstract@*/
234  if (h == NULL) return 0;
235  /*@=abstract@*/
236  return (h2hv(h)->hdrisentry) (h, tag);
237 }
238 
246 /*@unused@*/ static inline
247 /*@null@*/ void * headerFreeTag(Header h,
248  /*@only@*/ /*@null@*/ const void * data, rpmTagType type)
249  /*@modifies data @*/
250 {
251  if (h == NULL) return 0;
252  return (h2hv(h)->hdrfreetag) (h, data, type);
253 }
254 
268 /*@unused@*/ static inline
270  /*@null@*/ /*@out@*/ hTYP_t type,
271  /*@null@*/ /*@out@*/ void * p,
272  /*@null@*/ /*@out@*/ hCNT_t c)
273  /*@modifies *type, *p, *c @*/
274 {
275  if (h == NULL) return 0;
276  return (h2hv(h)->hdrget) (h, tag, type, p, c);
277 }
278 
291 /*@unused@*/ static inline
293  /*@null@*/ /*@out@*/ hTYP_t type,
294  /*@null@*/ /*@out@*/ void * p,
295  /*@null@*/ /*@out@*/ hCNT_t c)
296  /*@modifies *type, *p, *c @*/
297 {
298  if (h == NULL) return 0;
299  return (h2hv(h)->hdrgetmin) (h, tag, type, p, c);
300 }
301 
316 /*@mayexit@*/
317 /*@unused@*/ static inline
318 int headerAddEntry(Header h, int_32 tag, int_32 type, const void * p, int_32 c)
319  /*@modifies h @*/
320 {
321  return (h2hv(h)->hdradd) (h, tag, type, p, c);
322 }
323 
338 /*@unused@*/ static inline
340  const void * p, int_32 c)
341  /*@modifies h @*/
342 {
343  return (h2hv(h)->hdrappend) (h, tag, type, p, c);
344 }
345 
356 /*@unused@*/ static inline
358  const void * p, int_32 c)
359  /*@modifies h @*/
360 {
361  return (h2hv(h)->hdraddorappend) (h, tag, type, p, c);
362 }
363 
384 /*@unused@*/ static inline
385 int headerAddI18NString(Header h, int_32 tag, const char * string,
386  const char * lang)
387  /*@modifies h @*/
388 {
389  return (h2hv(h)->hdraddi18n) (h, tag, string, lang);
390 }
391 
402 /*@unused@*/ static inline
404  const void * p, int_32 c)
405  /*@modifies h @*/
406 {
407  return (h2hv(h)->hdrmodify) (h, tag, type, p, c);
408 }
409 
419 /*@unused@*/ static inline
421  /*@modifies h @*/
422 {
423  return (h2hv(h)->hdrremove) (h, tag);
424 }
425 
437 /*@unused@*/ static inline
438 /*@only@*/ char * headerSprintf(Header h, const char * fmt,
439  const struct headerTagTableEntry_s * tags,
440  const struct headerSprintfExtension_s * exts,
441  /*@null@*/ /*@out@*/ errmsg_t * errmsg)
442  /*@modifies *errmsg @*/
443 {
444  return (h2hv(h)->hdrsprintf) (h, fmt, tags, exts, errmsg);
445 }
446 
453 /*@unused@*/ static inline
454 void headerCopyTags(Header headerFrom, Header headerTo, hTAG_t tagstocopy)
455  /*@modifies headerFrom, headerTo @*/
456 {
457 /*@-noeffectuncon@*/ /* FIX: add rc */
458  hdrVec->hdrcopytags(headerFrom, headerTo, tagstocopy);
459 /*@=noeffectuncon@*/
460  return;
461 }
462 
468 /*@unused@*/ static inline
470  /*@modifies hi @*/
471 {
472  return hdrVec->hdrfreeiter(hi);
473 }
474 
480 /*@unused@*/ static inline
482  /*@modifies h */
483 {
484  return hdrVec->hdrinititer(h);
485 }
486 
496 /*@unused@*/ static inline
498  /*@null@*/ /*@out@*/ hTAG_t tag,
499  /*@null@*/ /*@out@*/ hTYP_t type,
500  /*@null@*/ /*@out@*/ hPTR_t * p,
501  /*@null@*/ /*@out@*/ hCNT_t c)
502  /*@modifies hi, *tag, *type, *p, *c @*/
503 {
504  return hdrVec->hdrnextiter(hi, tag, type, p, c);
505 }
506 
512 /*@unused@*/ static inline
513 /*@observer@*/ /*@null@*/ const char * headerGetOrigin(/*@null@*/ Header h)
514  /*@*/
515 {
516  return hdrVec->hdrgetorigin(h);
517 }
518 
525 /*@unused@*/ static inline
526 int headerSetOrigin(/*@null@*/ Header h, const char * origin)
527  /*@modifies h @*/
528 {
529  return hdrVec->hdrsetorigin(h, origin);
530 }
531 
537 /*@observer@*/ /*@null@*/
538 const char * headerGetBaseURL(/*@null@*/ Header h)
539  /*@*/;
540 
547 int headerSetBaseURL(/*@null@*/ Header h, const char * baseurl)
548  /*@modifies h @*/;
549 
555 struct stat * headerGetStatbuf(/*@null@*/ Header h)
556  /*@*/;
557 
564 int headerSetStatbuf(/*@null@*/ Header h, struct stat * st)
565  /*@modifies h @*/;
566 
572 /*@null@*/
573 const char * headerGetDigest(/*@null@*/ Header h)
574  /*@*/;
575 
582 int headerSetDigest(/*@null@*/ Header h, const char * digest)
583  /*@modifies h @*/;
584 
590 /*@unused@*/ static inline
591 int headerGetInstance(/*@null@*/ Header h)
592  /*@*/
593 {
594  return hdrVec->hdrgetinstance(h);
595 }
596 
603 /*@unused@*/ static inline
604 int headerSetInstance(/*@null@*/ Header h, int instance)
605  /*@modifies h @*/
606 {
607  return hdrVec->hdrsetinstance(h, instance);
608 }
609 
615 uint32_t headerGetStartOff(/*@null@*/ Header h)
616  /*@*/;
617 
624 uint32_t headerSetStartOff(/*@null@*/ Header h, uint32_t startoff)
625  /*@modifies h @*/;
626 
632 uint32_t headerGetEndOff(/*@null@*/ Header h)
633  /*@*/;
634 
641 uint32_t headerSetEndOff(/*@null@*/ Header h, uint32_t endoff)
642  /*@modifies h @*/;
643 
651 char * intFormat(HE_t he, /*@null@*/ const char ** av, const char * fmt)
652  /*@*/;
653 
654 /*@=voidabstract =nullpass =mustmod =compdef =shadow =predboolothers @*/
655 
656 #ifdef __cplusplus
657 }
658 #endif
659 
660 #endif /* H_HDRINLINE */
661 /*@=type@*/