Lines Matching refs:mp
612 register Namval_t *mp;
613 if((mp=vp->bltins[i]) && !nv_isattr(mp,NV_NOFREE))
615 if(is_abuiltin(mp))
617 if(mp->nvfun && !nv_isattr(mp,NV_NOFREE))
618 free((void*)mp->nvfun);
619 dtdelete(sh.bltin_tree,mp);
620 free((void*)mp);
873 void clone_all_disc( Namval_t *np, Namval_t *mp, int flags)
875 register Namfun_t *fp, **mfp = &mp->nvfun, *nfp, *fpnext;
884 nfp = (*fp->disc->clonef)(np,mp,flags,fp);
898 * clone <mp> from <np> flags can be one of the following
899 * NV_APPEND - append <np> onto <mp>
900 * NV_MOVE - move <np> to <mp>
905 int nv_clone(Namval_t *np, Namval_t *mp, int flags)
908 const char *val = mp->nvalue.cp;
909 unsigned short flag = mp->nvflag;
910 unsigned short size = mp->nvsize;
911 for(fp=mp->nvfun; fp; fp=fpnext)
919 mp->nvfun = fp;
922 if(nv_isattr(mp,NV_EXPORT|NV_MINIMAL) == (NV_EXPORT|NV_MINIMAL))
924 mp->nvenv = 0;
925 nv_offattr(mp,NV_MINIMAL);
927 if(!(flags&NV_COMVAR) && !nv_isattr(np,NV_MINIMAL) && np->nvenv && !(nv_isattr(mp,NV_MINIMAL)))
928 mp->nvenv = np->nvenv;
929 mp->nvflag &= NV_MINIMAL;
930 mp->nvflag |= np->nvflag&~(NV_ARRAY|NV_MINIMAL|NV_NOFREE);
931 flag = mp->nvflag;
932 clone_all_disc(np, mp, flags);
936 if(mp->nvsize == size)
937 nv_setsize(mp,nv_size(np));
938 if(mp->nvflag == flag)
939 mp->nvflag = (np->nvflag&~(NV_MINIMAL))|(mp->nvflag&NV_MINIMAL);
941 mp->nvflag |= (np->nvflag&NV_MINIMAL);
942 if(mp->nvalue.cp==val && !nv_isattr(np,NV_INTEGER))
947 mp->nvalue.cp = (char*)memdup(np->nvalue.cp,size);
949 mp->nvalue.cp = strdup(np->nvalue.cp);
950 nv_offattr(mp,NV_NOFREE);
952 else if(!(mp->nvalue.cp = np->nvalue.cp))
953 nv_offattr(mp,NV_NOFREE);
958 mp->nvalue.ip = np->nvalue.ip;
961 if(!nv_isattr(np,NV_MINIMAL) || nv_isattr(mp,NV_EXPORT))
963 mp->nvenv = np->nvenv;
972 if(nv_isattr(np,NV_INTEGER) && mp->nvalue.ip!=np->nvalue.ip && np->nvalue.cp!=Empty)
974 mp->nvalue.ip = (int*)num_clone(np,(void*)np->nvalue.ip);
975 nv_offattr(mp,NV_NOFREE);
998 Namval_t *mp = np->nvalue.np;
1002 nv_clone(mp,np,NV_NOFREE);
1015 Namval_t *nv_mkclone(Namval_t *mp)
1020 np->nvflag = mp->nvflag;
1021 np->nvsize = mp->nvsize;
1022 np->nvname = mp->nvname;
1023 np->nvalue.np = mp;
1024 np->nvflag = mp->nvflag;
1041 Namval_t *mp = (void*)name;
1042 if(!(np = dtsearch(root,mp)) && (mode&NV_ADD))
1043 name = nv_name(mp);
1254 static Namfun_t *clone_table(Namval_t* np, Namval_t *mp, int flags, Namfun_t *fp)
1266 mp = (Namval_t*)dtinsert(nroot,newnode(np->nvname));
1267 nv_clone(np,mp,flags);
1275 register Namval_t *nq, *mp;
1282 for(mp=(Namval_t*)dtfirst(root);mp;mp=nq)
1284 _nv_unset(mp,flags);
1285 nq = (Namval_t*)dtnext(root,mp);
1286 dtdelete(root,mp);
1287 free((void*)mp);
1376 Namval_t *mp, *pp;
1387 mp = (*fp->disc->createf)(pp,name,0,fp);
1390 mp = np;
1391 nv_offattr(mp,NV_TABLE);
1392 if(!nv_isnull(mp))
1393 _nv_unset(mp,NV_RDONLY);
1398 nv_disc(mp, &tp->fun, NV_FIRST);
1399 return(mp);