This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Commit: Add support for a temporary input line pointer in gas/read.c


Hi Alan,

>> +static char *saved_ilp = NULL;
>> +static char *saved_limit;
> 
> Can I suggest instead that you declare a struct save_ilp, use one of
> them as a local var, and pass that by reference to the save/restore
> functions.  They could be made inline too.

I could do this, but why ?  What do we gain.  It is not like these functions
need to be fast, or that they affect the performance of the assembler.


>> +  /* Prevent the assert in restore_ilp from triggering if
>> +     the input_line_pointer has not yet been initialised.  */
>> +  if (saved_ilp == NULL)
>> +    saved_limit = saved_ilp = (char *) "";
> 
> Changing saved_ilp means it really isn't saved!

True, but I just wanted to avoid having to create a third local variable
saying 'the saved_ilp has been initialised'.  It does not matter that we
"restore" the input_line_pointer to an empty buffer, because the only way
that this situation can arise is if the input_line_pointer has not yet
been used.

Cheers
  Nick



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]