This is just a pointer. It doesn't point to anything yet. The very next thing you do is use this invalid pointer: current->next = NULL; That could be trying to write to any memory whatsoever.
Do current=NULL; instead. A NULL head will mean an empty list. If you follow the logic in your function, it still works fine when head is NULL -- 'next' will be set to NULL, meaning end of list, and it won't crash because nothing uses the contents of 'head'.
Last edited by Corona688; 03-31-2011 at 05:00 PM..
i have a linked list set up like
typedef struct client_list {
char *client_name;
int client_socket_fd;
struct client_list *next;
} client;
client *client_list=NULL;
before adding to the list i check if it already exists, only if it does not then i add
if (client_list==NULL... (1 Reply)
can someone provide an example of a struct linked list, where it has strings as its values, and then how do I check if a specific string (say called buffer) exists in the list of structs?
i dont understand how to make a copy of it to check with
this is what i have
... (0 Replies)
Hi, I am programming in kernel, and I want to use a double linked list that holds infos that every process could access and modify THIS list. So, I suppose it is a 'global' variable since every process(thread) can reach it, I am wondering where to put it? by changing some of the kernel files? (1 Reply)
Program to reverse a linked list by traversing only once. (1 Reply)
Discussion started by: VSSajjan
1 Replies
LEARN ABOUT SUSE
delptype
DELPTYPE(3) MBK UTILITY FUNCTIONS DELPTYPE(3)NAME
delptype - delete an element of a ptype_list
ORIGIN
This software belongs to the ALLIANCE CAD SYSTEM developed by the ASIM team at LIP6 laboratory of Universite Pierre et Marie CURIE, in
Paris, France.
Web : http://asim.lip6.fr/recherche/alliance/
E-mail : alliance-users@asim.lip6.fr
SYNOPSYS
#include "mut.h"
ptype_list *delptype(pthead, type)
ptype_list *pthead;
long type;
PARAMETERS
pthead Pointer to a ptype list
type The pointer of this type is to be deleted.
DESCRIPTION
delptype deletes the element of the ptype_list that has the type type in the list pointed to by pthead. The list consistency is main-
tained, and the element put back in the list of free blocks.
RETURN VALUE
delptype returns a pointer to the new head of list if a typed pointer used to belong to the list. In most case, it has the value of pthead.
If the type doesn't belong to the list, NULL is returned.
ERROR
"*** mbk error *** delptype impossible : pthead = NULL"
The pointer to the head of list is NULL, and that clear that such a list can't be ran thru.
EXAMPLE
#include "mut.h"
#include "mph.h"
void delete_user(ptfig)
phfig_list *ptfig;
{
phins_list *i;
for (i = ptfig->PHINS; i; i = i->NEXT)
i->USER = delptype(i->USER, PLACEABOX);
}
SEE ALSO mbk(1), ptype(3), addptype(3), getptype(3), freeptype(3).
BUG REPORT
This tool is under development at the ASIM department of the LIP6 laboratory.
We need your feedback to improve documentation and tools.
ASIM /LIP6 October 1, 1997 DELPTYPE(3)