Descriptive comment regarding the allocation of the return values.
Showing
1 changed file
with
8 additions
and
3 deletions
... | @@ -16,7 +16,7 @@ | ... | @@ -16,7 +16,7 @@ |
16 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ | 16 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ |
17 | 17 | ||
18 | /* MH context functions. */ | 18 | /* MH context functions. */ |
19 | 19 | ||
20 | #include <mh.h> | 20 | #include <mh.h> |
21 | #include <sys/types.h> | 21 | #include <sys/types.h> |
22 | #include <sys/stat.h> | 22 | #include <sys/stat.h> |
... | @@ -107,8 +107,13 @@ mh_context_write (mh_context_t *ctx) | ... | @@ -107,8 +107,13 @@ mh_context_write (mh_context_t *ctx) |
107 | return 0; | 107 | return 0; |
108 | } | 108 | } |
109 | 109 | ||
110 | /* FIXME: mh_context_get_value returns a pointer to the allocated memory. | ||
111 | Instead, it should return a const pointer to the static storage within | ||
112 | the header_t structure and be declared as | ||
113 | `const char *mh_context_get_value()'. Current implementation of | ||
114 | header_.* functions does not allow that. */ | ||
110 | char * | 115 | char * |
111 | mh_context_get_value (mh_context_t *ctx, const char *name, char *defval) | 116 | mh_context_get_value (mh_context_t *ctx, const char *name, const char *defval) |
112 | { | 117 | { |
113 | char *p; | 118 | char *p; |
114 | 119 | ||
... | @@ -118,7 +123,7 @@ mh_context_get_value (mh_context_t *ctx, const char *name, char *defval) | ... | @@ -118,7 +123,7 @@ mh_context_get_value (mh_context_t *ctx, const char *name, char *defval) |
118 | } | 123 | } |
119 | 124 | ||
120 | int | 125 | int |
121 | mh_context_set_value (mh_context_t *ctx, const char *name, char *value) | 126 | mh_context_set_value (mh_context_t *ctx, const char *name, const char *value) |
122 | { | 127 | { |
123 | if (!ctx->header) | 128 | if (!ctx->header) |
124 | { | 129 | { | ... | ... |
-
Please register or sign in to post a comment