LCOV - code coverage report
Current view: top level - misc/kabi/lvm2.git/lib/format_text - tags.c (source / functions) Hit Total Coverage
Test: unnamed Lines: 0 25 0.0 %
Date: 2010-04-13 Functions: 0 2 0.0 %
Branches: 0 20 0.0 %

           Branch data     Line data    Source code
       1                 :            : /*
       2                 :            :  * Copyright (C) 2003-2004 Sistina Software, Inc. All rights reserved.
       3                 :            :  * Copyright (C) 2004-2005 Red Hat, Inc. All rights reserved.
       4                 :            :  *
       5                 :            :  * This file is part of LVM2.
       6                 :            :  *
       7                 :            :  * This copyrighted material is made available to anyone wishing to use,
       8                 :            :  * modify, copy, or redistribute it subject to the terms and conditions
       9                 :            :  * of the GNU Lesser General Public License v.2.1.
      10                 :            :  *
      11                 :            :  * You should have received a copy of the GNU Lesser General Public License
      12                 :            :  * along with this program; if not, write to the Free Software Foundation,
      13                 :            :  * Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
      14                 :            :  */
      15                 :            : 
      16                 :            : #include "lib.h"
      17                 :            : #include "metadata.h"
      18                 :            : #include "import-export.h"
      19                 :            : #include "str_list.h"
      20                 :            : #include "lvm-string.h"
      21                 :            : 
      22                 :          0 : int print_tags(struct dm_list *tags, char *buffer, size_t size)
      23                 :            : {
      24                 :            :         struct str_list *sl;
      25                 :          0 :         int first = 1;
      26                 :            : 
      27         [ #  # ]:          0 :         if (!emit_to_buffer(&buffer, &size, "["))
      28                 :          0 :                 return_0;
      29                 :            : 
      30         [ #  # ]:          0 :         dm_list_iterate_items(sl, tags) {
      31         [ #  # ]:          0 :                 if (!first) {
      32         [ #  # ]:          0 :                         if (!emit_to_buffer(&buffer, &size, ", "))
      33                 :          0 :                                 return_0;
      34                 :            :                 } else
      35                 :          0 :                         first = 0;
      36                 :            : 
      37         [ #  # ]:          0 :                 if (!emit_to_buffer(&buffer, &size, "\"%s\"", sl->str))
      38                 :          0 :                         return_0;
      39                 :            :         }
      40                 :            : 
      41         [ #  # ]:          0 :         if (!emit_to_buffer(&buffer, &size, "]"))
      42                 :          0 :                 return_0;
      43                 :            : 
      44                 :          0 :         return 1;
      45                 :            : }
      46                 :            : 
      47                 :          0 : int read_tags(struct dm_pool *mem, struct dm_list *tags, struct config_value *cv)
      48                 :            : {
      49         [ #  # ]:          0 :         if (cv->type == CFG_EMPTY_ARRAY)
      50                 :          0 :                 return 1;
      51                 :            : 
      52         [ #  # ]:          0 :         while (cv) {
      53         [ #  # ]:          0 :                 if (cv->type != CFG_STRING) {
      54                 :          0 :                         log_error("Found a tag that is not a string");
      55                 :          0 :                         return 0;
      56                 :            :                 }
      57                 :            : 
      58         [ #  # ]:          0 :                 if (!str_list_add(mem, tags, dm_pool_strdup(mem, cv->v.str)))
      59                 :          0 :                         return_0;
      60                 :            : 
      61                 :          0 :                 cv = cv->next;
      62                 :            :         }
      63                 :            : 
      64                 :          0 :         return 1;
      65                 :            : }

Generated by: LCOV version 1.8