Skip to content

Commit

Permalink
Added automatic digest caching, and LGPL blocks.
Browse files Browse the repository at this point in the history
  • Loading branch information
vogon committed Oct 17, 2002
1 parent 522e731 commit 587d0bb
Show file tree
Hide file tree
Showing 9 changed files with 676 additions and 61 deletions.
56 changes: 37 additions & 19 deletions libinews/IList.c
@@ -1,22 +1,37 @@
/* LibINews -- the only IcculusNews backend with the power of nougat
* copyright (c) 2002 Colin "vogon" Bayer
*
* [ -- Insert GPL boilerplate here -- ]
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/

#include "IList.h"

/* IList, the helping phriendly doubly-linked list. */

IList *ilist_append(IList *list, IList *new);
IList *ilist_append(IList *list, IList *new_ptr);
IList *ilist_append_data(IList *list, void *data);

IList *ilist_prepend(IList *list, IList *new);
IList *ilist_prepend(IList *list, IList *new_ptr);
IList *ilist_prepend_data(IList *list, void *data);

IList *ilist_remove(IList *ptr);

IList *ilist_first(IList *list);
IList *ilist_last(IList *list);

unsigned int ilist_length(IList *ptr);

IList *__get_last(IList *list);
Expand All @@ -25,36 +40,36 @@ IList *__get_first(IList *list);
/* FIXME: extremely quick implementation. probably 50 zillion bugs in the next
* 65 lines, but who's counting? -- vogon. */

IList *ilist_append(IList *list, IList *new) {
new->prev = __get_last(list);
if (new->prev) new->prev->next = new;
new->next = NULL;
IList *ilist_append(IList *list, IList *new_ptr) {
new_ptr->prev = __get_last(list);
if (new_ptr->prev) new_ptr->prev->next = new_ptr;
new_ptr->next = NULL;

return __get_first(new);
return __get_first(new_ptr);
}

IList *ilist_append_data(IList *list, void *data) {
IList *new = (IList *)malloc(sizeof(IList));
IList *new_ptr = (IList *)malloc(sizeof(IList));

new->data = data;
new_ptr->data = data;

return ilist_append(list, new);
return ilist_append(list, new_ptr);
}

IList *ilist_prepend(IList *list, IList *new) {
new->next = __get_first(list);
if (new->next) new->next->prev = new;
new->prev = NULL;
IList *ilist_prepend(IList *list, IList *new_ptr) {
new_ptr->next = __get_first(list);
if (new_ptr->next) new_ptr->next->prev = new_ptr;
new_ptr->prev = NULL;

return new;
return new_ptr;
}

IList *ilist_prepend_data(IList *list, void *data) {
IList *new = (IList *)malloc(sizeof(IList));
IList *new_ptr = (IList *)malloc(sizeof(IList));

new->data = data;
new_ptr->data = data;

return ilist_prepend(list, new);
return ilist_prepend(list, new_ptr);
}

IList *ilist_remove(IList *ptr) {
Expand Down Expand Up @@ -89,3 +104,6 @@ IList *__get_first(IList *list) {

return first;
}

IList *ilist_first(IList *list) { return __get_first(list); }
IList *ilist_last(IList *list) { return __get_last(list); }
21 changes: 18 additions & 3 deletions libinews/IList.h
@@ -1,7 +1,19 @@
/* LibINews -- the only IcculusNews backend with the power of nougat
* copyright (c) 2002 Colin "vogon" Bayer
*
* [ -- Insert GPL boilerplate here -- ]
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/

Expand All @@ -17,14 +29,17 @@ struct _IList {

typedef struct _IList IList;

extern IList *ilist_append(IList *list, IList *new);
extern IList *ilist_append(IList *list, IList *new_ptr);
extern IList *ilist_append_data(IList *list, void *data);

extern IList *ilist_prepend(IList *list, IList *new);
extern IList *ilist_prepend(IList *list, IList *new_ptr);
extern IList *ilist_prepend_data(IList *list, void *data);

extern IList *ilist_remove(IList *ptr);

extern IList *ilist_first(IList *ptr);
extern IList *ilist_last(IList *ptr);

extern unsigned int ilist_length(IList *ptr);

#define ilist_free(ptr) free(ptr)
Expand Down
14 changes: 13 additions & 1 deletion libinews/IcculusNews.h
@@ -1,7 +1,19 @@
/* LibINews -- the only IcculusNews backend with the power of nougat
* copyright (c) 2002 Colin "vogon" Bayer
*
* [ -- Insert GPL boilerplate here -- ]
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/

Expand Down

0 comments on commit 587d0bb

Please sign in to comment.