From: "Alphex K." <alphex@crew.org.ru>
To: Glynn Clements <glynn.clements@virgin.net>
Cc: linux-c-programming@vger.kernel.org
Subject: Re: Some troubles with linked list/tree
Date: Fri, 30 Apr 2004 19:18:46 +0400 [thread overview]
Message-ID: <20040430191846.13580061.alphex@crew.org.ru> (raw)
In-Reply-To: <16530.22206.809391.568597@cerise.nosuchdomain.co.uk>
On Fri, 30 Apr 2004 14:38:06 +0100
Glynn Clements <glynn.clements@virgin.net> wrote:
>
>
> Alphex K. wrote:
>
> > > > I try some methods but it doesn't work?
> > >
> > > You are trying to add to action->list, but action->list starts out
> > > uninitialised (i.e. containing garbage).
> >
> > How I can initializate it in OapAdvAction * AddAdvAction(OapAdvAction * action,char *name,char *author,
> > char *note,int cl_id,SfList * list) ?? it's my question.
>
> Set:
>
> action->list=NULL;
>
> before attempting to add entries with AddSfEntry().
>
thanx
It work, but when I try to read from OapAdvAction I fecth "Seg fault" or incorrect value in on of the
fields - and broken SfList * list; - But when I try view this in first attempt - it worked normally
Where is my error -
so it's function show content - (to gtk clist)
void _FillActionsTable(OapAdvAction *list,int what)
{
OapAdvAction * lp=NULL;
OapAdvAction * temp=NULL;
temp=OapCpyAdvAction(temp,actions);
lp=OapCpyAdvAction(lp,actions);
char *entr[3];
while(lp!=NULL)
{
entr[0]=calloc(1,8);
sprintf(entr[0],"-%d-",lp->id);
entr[1]=lp->name;
entr[2]=lp->author;
entr[3]=lp->note;
if(what==0)
gtk_clist_append(GTK_CLIST(imanactlist),entr);
else
gtk_clist_append(GTK_CLIST(iviewactactionlist),entr);
free(entr[1]);
lp=lp->next;
}
lp=OapFreeAdvAction(lp);
actions=OapFreeAdvAction(actions);
actions=OapCpyAdvAction(actions,temp);
temp=OapFreeAdvAction(temp);
}
where actions is global variable (OapAdvAction * actions)
and functions -
OapAdvAction * OapFreeAdvAction(OapAdvAction * action)
{
while(action!=NULL)
{
action->list=FreeSfList(action->list);
action=DelAdvAction(action,action->id);
}
return action;
}
OapAdvAction * OapCpyAdvAction(OapAdvAction * daction,OapAdvAction * saction)
{
daction=NULL;
while(saction!=NULL)
{
daction=AddAdvAction(daction,saction->name,saction->author,saction->note,
saction->cl_id,saction->list);
saction=saction->next;
}
return daction;
}
thanx for advance.
> --
> Glynn Clements <glynn.clements@virgin.net>
> -
> To unsubscribe from this list: send the line "unsubscribe linux-c-programming" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
---===---
Alphex Kaanoken
Senior developer of Crew IT research labs
web: http://crew.org.ru
mailto:Alphex@Crew.Org.RU
next prev parent reply other threads:[~2004-04-30 15:18 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-04-29 15:39 Some troubles with linked list/tree Alphex K.
2004-04-30 4:25 ` Glynn Clements
2004-04-30 9:15 ` Alphex K.
2004-04-30 13:38 ` Glynn Clements
2004-04-30 15:18 ` Alphex K. [this message]
2004-04-30 18:38 ` Glynn Clements
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20040430191846.13580061.alphex@crew.org.ru \
--to=alphex@crew.org.ru \
--cc=glynn.clements@virgin.net \
--cc=linux-c-programming@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).