00001 /* 00002 * Microfeed - Backend for accessing feed-based services 00003 * Copyright (C) 2009 Henrik Hedberg <henrik.hedberg@innologies.fi> 00004 * 00005 * This program is free software; you can redistribute it and/or modify 00006 * it under the terms of the GNU General Public License version 2 as published by 00007 * the Free Software Foundation. 00008 * 00009 * This program is distributed in the hope that it will be useful, 00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 * GNU General Public License for more details. 00013 * 00014 * You should have received a copy of the GNU General Public License along 00015 * with this program; if not, write to the Free Software Foundation, Inc., 00016 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 00017 */ 00018 00019 #include <microfeed-provider/microfeederror.h> 00020 #include <microfeed-common/microfeedmisc.h> 00021 00022 #include <string.h> 00023 00024 struct _MicrofeedError { 00025 char* name; 00026 char* message; 00027 }; 00028 00029 MicrofeedError* microfeed_error_new(const char* name, const char* message) { 00030 MicrofeedError* error; 00031 00032 error = microfeed_memory_allocate(MicrofeedError); 00033 error->name = (name ? strdup(name) : NULL); 00034 error->message = (message ? strdup(message) : NULL); 00035 00036 return error; 00037 } 00038 00039 void microfeed_error_free(MicrofeedError* error) { 00040 free(error->name); 00041 free(error->message); 00042 microfeed_memory_free(error); 00043 } 00044 00045 const char* microfeed_error_get_name(MicrofeedError* error) { 00046 00047 return error->name; 00048 } 00049 00050 const char* microfeed_error_get_message(MicrofeedError* error) { 00051 00052 return error->message; 00053 }