X-Git-Url: http://git.efficios.com/?p=babeltrace.git;a=blobdiff_plain;f=types%2Fstring.c;h=255388f0dcb7ab5ea433384c89433d68edc4cf0f;hp=dadcd080e71fc69cd7ae5b704b13d45014121940;hb=becd02a104b8c1634ce914d1d2cd36be932b9b16;hpb=da320b838f4deeaae4314c18c507ca486243b0fe diff --git a/types/string.c b/types/string.c index dadcd080..255388f0 100644 --- a/types/string.c +++ b/types/string.c @@ -16,6 +16,14 @@ * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. */ #include @@ -40,7 +48,7 @@ void _string_declaration_free(struct declaration *declaration) } struct declaration_string * - string_declaration_new(enum ctf_string_encoding encoding) + bt_string_declaration_new(enum ctf_string_encoding encoding) { struct declaration_string *string_declaration; @@ -68,7 +76,7 @@ struct definition * int ret; string = g_new(struct definition_string, 1); - declaration_ref(&string_declaration->p); + bt_declaration_ref(&string_declaration->p); string->p.declaration = declaration; string->declaration = string_declaration; string->p.ref = 1; @@ -96,12 +104,23 @@ void _string_definition_free(struct definition *definition) struct definition_string *string = container_of(definition, struct definition_string, p); - declaration_unref(string->p.declaration); + bt_declaration_unref(string->p.declaration); g_free(string->value); g_free(string); } -char *get_string(const struct definition *field) +enum ctf_string_encoding bt_get_string_encoding(const struct definition *field) +{ + struct definition_string *string_definition; + const struct declaration_string *string_declaration; + + string_definition = container_of(field, struct definition_string, p); + string_declaration = string_definition->declaration; + + return string_declaration->encoding; +} + +char *bt_get_string(const struct definition *field) { struct definition_string *string_definition = container_of(field, struct definition_string, p);