File object_print_util.cpp¶
File List > cubrid > src > object > object_print_util.cpp
Go to the documentation of this file
/*
* Copyright 2008 Search Solution Corporation
* Copyright 2016 CUBRID Corporation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
/*
* object_print_util.cpp
*/
#include "object_print_util.hpp"
#include "work_space.h"
#include <assert.h>
/*
* obj_print_free_strarray() - Most of the help functions build an array of
* strings that contains the descriptions
* of the object
* return: none
* strs(in) : array of strings
*
* Note :
* This function frees the array when it is no longer necessary.
*/
void object_print::free_strarray (char **strs)
{
int i;
if (strs == NULL)
{
return;
}
for (i = 0; strs[i] != NULL; i++)
{
free_and_init (strs[i]);
}
free_and_init (strs);
}
/*
* obj_print_copy_string() - Copies a string, allocating space with malloc
* return: new string
* source(in) : string to copy
*/
char *object_print::copy_string (const char *source)
{
char *new_str = NULL;
if (source != NULL)
{
new_str = (char *) malloc (strlen (source) + 1);
if (new_str != NULL)
{
strcpy (new_str, source);
}
}
return new_str;
}