private Namespace createNamespace(Program resultProgram, String name, SymbolType st,
			Address resultAddr, Namespace resultParentNs, Program srcPgm, long srcSymID,
			SourceType source) throws DuplicateNameException, InvalidInputException {
		SymbolTable symtab = resultProgram.getSymbolTable();
		// Need to create a unique named namespace that is equivalent to original.
		for (int i = 0; i < Integer.MAX_VALUE; i++) {
			String uniqueSymbolName =
				(i == 0) ? name : name + ProgramMerge.SYMBOL_CONFLICT_SUFFIX + i;

			Namespace ns = symtab.getNamespace(uniqueSymbolName, resultParentNs);
			if (ns != null) {
				Symbol s = ns.getSymbol();
				if (!s.getAddress().equals(resultAddr) || !s.getSymbolType().equals(st)) {
					continue; // Not the right one, so go to next conflict name.
				}
				// Found the equivalent namespace so return it.
				return ns;
			}
			// Create it, since nothing with this conflict name.
			Symbol uniqueSymbol = createSymbol(uniqueSymbolName, st, resultAddr, resultParentNs,
				srcPgm, srcSymID, source);
			if (uniqueSymbol != null) {
				Object obj = uniqueSymbol.getObject();
				if (obj instanceof Namespace) {
					if (!uniqueSymbolName.equals(name)) {
						renamedConflictIDs.add(uniqueSymbol.getID());
					}
					return (Namespace) obj;
				}
			}
			break; // Otherwise throw exception
		}
		throw new DuplicateNameException("Couldn't create namespace '" + name + "' in namespace '" +
			resultParentNs.getName(true) + "'.");
	}
Get/create a uniquely named namespace. If the namespace's name can't
be created because of a name conflict, it will be given a new conflict name.
@param resultProgram the program where the namespace is to be found or created
@param name the desired name for the namespace
@param st the symbol type for this namespace
@param resultAddr the address in the result program for this namespace
@param resultParentNs the parent of this namespace in the result program
@param origPgm the program this namespace originated from
@param origSymID the ID of the namespace in the program it originated from
@return an equivalent namespace that exists or was created.
@throws DuplicateNameException if the namespace couldn't be created
because of an unresolvable name conflict.
@throws InvalidInputException if the namespace couldn't be created
because of an invalid name.
Ghidra/Features/Base/src/main/java/ghidra/app/merge/listing/SymbolMerger.java