71 |
fread (blurb, st.st_size, 1, fp); |
fread (blurb, st.st_size, 1, fp); |
72 |
fclose (fp); |
fclose (fp); |
73 |
|
|
74 |
if (status = header_create (&ctx->header, blurb, st.st_size, NULL)) |
if ((status = header_create (&ctx->header, blurb, st.st_size, NULL)) != 0) |
75 |
free (blurb); |
free (blurb); |
76 |
|
|
77 |
return status; |
return status; |
111 |
Instead, it should return a const pointer to the static storage within |
Instead, it should return a const pointer to the static storage within |
112 |
the header_t structure and be declared as |
the header_t structure and be declared as |
113 |
`const char *mh_context_get_value()'. Current implementation of |
`const char *mh_context_get_value()'. Current implementation of |
114 |
header_.* functions does not allow that. */ |
header_.* functions does not allow that. |
115 |
|
|
116 |
|
This has two drawbacks: |
117 |
|
1) The function is declared as returning char * instead of |
118 |
|
intended const char *. |
119 |
|
2) Ugly typecast when returning defval. */ |
120 |
|
|
121 |
char * |
char * |
122 |
mh_context_get_value (mh_context_t *ctx, const char *name, const char *defval) |
mh_context_get_value (mh_context_t *ctx, const char *name, const char *defval) |
123 |
{ |
{ |
124 |
char *p; |
char *p; |
125 |
|
|
126 |
if (header_aget_value (ctx->header, name, &p)) |
if (header_aget_value (ctx->header, name, &p)) |
127 |
p = defval; |
p = (char *) defval; |
128 |
return p; |
return p; |
129 |
} |
} |
130 |
|
|