Task #122

envvars.c: work on envvars_variable_delete()

Added by Andreas Schröder almost 4 years ago.

Status:NewStart date:06/02/2010
Priority:NormalDue date:
Assignee:-% Done:

0%

Category:all
Target version:0.64.5

Description

...
  // Copy all but the deleted one to the new allocated space
  int i,j;
  for (i = 0,j = 0; i < envvars->nvariables; i++) {
    // FIXME: What would happen with two variables with the same name ?
    if (strncmp(envvars->variables.ptr[i].name,name,MAXNAMELEN) == 0) {
      continue;
    }
    memcpy (&new_envvars.variables.ptr[j],&envvars->variables.ptr[i],sizeof(struct envvar));
    j++;
  }
...

Also available in: Atom PDF