[PD-dev] changes in atom_getsymbol between pd 0.40-3 and 0.42.4?

Martin Peach martin.peach at sympatico.ca
Thu Feb 18 03:37:47 CET 2010


Maybe easiest and safest is to make sure sizeof(gphoto_gimme_struct) is 
big enough to hold some maximum number of args by declaring it a fixed size:

#define MAXARGS 339966
     t_atom argv[MAXARGS];

instead of

     t_atom *argv;

and then copy up to MAXARGS atoms in a loop:

     for (i = 0; (i < argc)&&(i < MAXARGS); ++i)
       threadargs->argv[i] = argv[i];

instead of

     threadArgs->argv = argv;

...or you could leave the struct alone and separately allocate the 
precise amount of memory for argc atoms, as

     threadArgs->argv = malloc(sizeof(*argv)*argc));

and then copy them over.

Martin


B. Bogart wrote:
> Thanks Martin,
> 
> I can't get the syntax right, care to give me a hint?
> 
> B. Bogart
> 
> martin.peach at sympatico.ca wrote:
>>> So what have I misunderstood?
>>
>> argv is a pointer, it's size is 4. You're still not copying whatever 
>> argv is pointing to.
>>
>> Martin
>>
>>                            
>> _______________________________________________
>> Pd-dev mailing list
>> Pd-dev at iem.at
>> http://lists.puredata.info/listinfo/pd-dev
>>
> 
> _______________________________________________
> Pd-dev mailing list
> Pd-dev at iem.at
> http://lists.puredata.info/listinfo/pd-dev
> 
> 





More information about the Pd-dev mailing list