linux-c-programming.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Glynn Clements <glynn.clements@virgin.net>
To: "Alphex K." <alphex@crew.org.ru>
Cc: linux-c-programming@vger.kernel.org
Subject: Re: Some troubles with linked list/tree
Date: Fri, 30 Apr 2004 19:38:16 +0100	[thread overview]
Message-ID: <16530.40216.44668.159290@cerise.nosuchdomain.co.uk> (raw)
In-Reply-To: <20040430191846.13580061.alphex@crew.org.ru>


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().
> 

> 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;

For a start, "entr" only has three elements (entr[0] to entr[2]), so
you shouldn't be assigning to entr[3]. Doing so will typically
overwrite one of the other local variables.

-- 
Glynn Clements <glynn.clements@virgin.net>

      reply	other threads:[~2004-04-30 18:38 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.
2004-04-30 18:38         ` Glynn Clements [this message]

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=16530.40216.44668.159290@cerise.nosuchdomain.co.uk \
    --to=glynn.clements@virgin.net \
    --cc=alphex@crew.org.ru \
    --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).